Opening Files

Hey guys, Im not sure why this isnt working. Hoping someone can tell me what is wrong. Any time I try and run this it crashes.
1
2
3
4
5
6
7
	string onerecord[2];
	string oneline;
	ifstream monthsfile;
	string baseDir = "C:\\Users\\Brian\\Desktop/"; // I think the problem is here, but cant figufre out what.
	monthsfile.open(baseDir + "months.txt");
	int currentRecord = 0;
	month months[12];
I don't think there's enough information to say what's wrong. That code by itself looks harmless enough. The inconsistent use of '\\' and '/' looks a little odd, but seems ok.

Two questions, what do you mean when you say "it crashes" - is there a particular error message or code displayed? What reason do you have for looking in this section of code for the cause?

You will need to post more of your code, at least enough to recreate the error.
Last edited on
Topic archived. No new replies allowed.