code::blocks will not open .txt file

Dec 9, 2009 at 5:01pm
Hi, ive been having an issue with code::blocks where the lines below will not open the .txt file when i run the program within code::blocks. However if i go to the .exe file that code::blocks creates and manually run it, it loads it fine. the .txt is properly named and in the same directory as it should be. Are there any other codeblocks users out there that know how to fix this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
void dictionary () {

   string line;
                ifstream Myfile("words.txt");

            if(Myfile.is_open())    //opens dictionary
                {
            while(!Myfile.eof())
                {
                getline(Myfile,line);
                words[wordplace]=line;
                wordplace=wordplace+1;

          }}}
Dec 9, 2009 at 5:09pm
You should edit the Execution Working dir. found on Project Properties > Build Targets
-That is the directory in which you should locate the files-
Last edited on Dec 9, 2009 at 5:10pm
Dec 9, 2009 at 5:33pm
i changed it from "." to ...\c++\board\bin\debug, where both the .exe file and the .txt file is located, but i still cant get it to work. is there a specific place i should point it too?
Topic archived. No new replies allowed.