Getting Word Doc in program!!!

Okay for my final program for my C++ class we have to make a program of our own and i want to do a chose your own adventure but i have problems of how to get a word doc into the program so that the person know what they choses so is they a way to know that please help. i really want this program to work well. and thank you for helping me. if you need more info on what the program is about please emial me at lamb_1994@hotmail.com and thank you again
Last edited on
Why would you want to import a word document into your program??

Word does a lot of En-Decoding (that users don't see)

The easiest way to import from a file in C++ is .txt files which you do like so:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <fstream>
#include <string>
using namespace std;

int main()
{
ifstream file;
string lineFromFile;
file.open("textFileName.txt");
while(line != null)
{
file >> lineFromFile;

//Tests e.g. If 
}
file.close();
return 0;
}


Good luck let me know how it works out :D
Last edited on
thank you and i will do that. the reason i want to import the word file is because i am writeing the parts of the adventer in world and don't want to put in all in the program and i want to keep the program as short as i can make it and thank you
Write that in a normal text file. Word documents are stored as XML and contain lots of formatting information and such.
It would require far too much effort to read in a .doc/x file format using purely C++. Just write your adventure text in a plain .txt file and read it in.
Write it in word. Then save it as a basic .txt file without formatting. Problem solved.

You're going to be looking at many hundreds of hours to incorporate the functionality to read word documents into your application. Probably more given your current level of programming experience.
Topic archived. No new replies allowed.