Reputation: 1407
I have been having trouble with opening files with ifstream
if I do:
ifstream myfile;
myfile.open("C:/Users/build/windows/Debug/map1.xml");
it works fine, but if I do a relative path (the executable is in Debug/)
ifstream myfile;
myfile.open("map1.xml");
It will not find the file. Any help? Am I missing something silly?
Upvotes: 1
Views: 3818
Reputation:
Most likely, your IDE changes your program's working directory when launching it. Try putting map1.xml
into c:\users\build\windows
Upvotes: 3