Opening and Reading .doc/.docx files

I know how to read the text of a simple text document (.rtf/.txt) by using an ifstream and appending each line, but .doc or .docx files will read as something like "ÐÏࡱ" or "PK(other symbols)". I want to be able to open and append each line of a .doc/.docx document into a std:string.

Heres the code i use for reading simple text documents:
1
2
3
4
5
6
7
8
9
10
11
	ifstream myfile(path);
	if (myfile.is_open())
	{
		while ( myfile.good() )
		{
			getline (myfile,readfrom);
			writefrom.append(readfrom+"\n");
		}
		myfile.close();
	}
	else{}
.doc(x)s are not plain text; you will have to interpret and parse the format yourself.
Topic archived. No new replies allowed.