Input output file

I have tried to open the particular file, but i didnt managed to open it, i wonder where is the file i supposed to save it at, in the debug folder or the current working directory. Why the program will skip this ----if(!myfile)-----
Please help me with some suggested source of problem.

void readTextFile(){
ifstream myfile;
bool check=false;
string line;
myfile.open ("fileList.txt",ios::in);
if(!myfile){
check = true;
if (myfile.is_open()) {
while (!myfile.eof()){
getline(myfile,line);
cout<<line;
//vector push creates a new element
}
}
}
else cout<<"\n unable to open file";
}
In windows:
How are you executing your .exe? In visual studio you can press CTRL+F5 to execute your program, but it won't use the configuration directory as the current directory.

If you call the .exe from the console without having the current directory as the root directory of the .exe, then it won't find the file there either.
Oh, okay, It works! Thanks..
but now i'm facing error that

if(myfile.good())

is not working.. i cant read information from it..
Do you know why?
I mean, i found the location to put the file where i can proceed on to read the file, but the reading file portion, i'm stuck.
Topic archived. No new replies allowed.