Making .docs with c++, suitable for beginner?

Dear programmers,
Earlyer this week i started doing c++, and i havent done enything else since then. After some practice assignments from xoax.net i decided to start on a project on my own: something to make repetitive .doc creation easyer and faster (something i happen to do allot at work and is a waste of my time).
I have got two questions concerning this project:

1. Is it executable/not to advanced for a beginner like me?

2. Is answer 1 = yes:
I found that "myfile.open("...") and myfile << "..."; work perfectly with pre-entered strings. However, they dont work with stings (strTitle and strFulltext), wich are the result of functions (titlefile() and fulltext (). Is there a way to fix this?

1
2
3
4
5
6
7
8
9
10
int main() {
	titlefile();
	ofstream myfile;
	myfile.open(strTitle);
	fulltext();
	std::string strfulltext;
	myfile << strfulltext;
	myfile.close();
	return 0;
}


I did not include both functions wich make the new strings due to their lenght. They work well tho.

Greetings,
Jorrit
Parsing a .doc file is probably a big pain, regardless of how well you know the programming language. There's surely parsers already written somewhere on the internet. But if that's something you want to focus on and learn, then by all means you should still try.

To your second question, you'll need to do myfile.open(my_string.c_str());.
The better solution would be to compile your program with C++11 or C++14 (-std=c++11 or -std=c++14 ), to make it so open() will accept an std::string.
Last edited on
Topic archived. No new replies allowed.