# debuggersays file.good()=false usual run true...

This topic is 4963 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi My problem is that when i run my small programm that imports a model file runs through the Vs .net 2003 debugger my message box pops up saying that the modellfile wasn't found (file.good()=false) but when i run it "usually" (running the .exe through the explorer) the messagebox doesn't pop up. So my first (main) problem is why doesn't it find the file if just tell him to open "test2.ngm" and the file is in the same folder than the .exe? But as running the .exe doesn't result in an error i'm not even sure if it doesn't find the model. So why does the debugger say file.good()=false and the usual .exe file.good()=true? My code:
	std::ifstream file;
file.open("test2.ngm",std::ios::in,std::ios::binary);
if(file.good())
{
{
Vertex vert;
Verts.push_back(vert);
}

{
short index;
Indices.push_back(index);
}
}else{
PostQuitMessage(1);

}


regards, m4gnus

##### Share on other sites
I'm not sure if this is still the case with VC7. In VC6, though, the compiled program is placed in a sub directory (Debug/Release) of the project. The IDE runs the executable with the project dir as the working directory. So any files with no pathnames are opened from there. If you run the program from the subdir, the program will try to open the files from the subdir, but they are not there.

If you don't get what I mean:
C:\Project  - VS files  - source files  - important file the app needs  Debug    - program exe

Greetz,

Illco

##### Share on other sites
Ilco is correct.

You can change the default directory by adding a full path (or a path relative to the project directory) under Project->Properties->Debugging->Working Directory for each release.

This means that when you run the exe in the debugger, it will run with that directory as it's working directory.

##### Share on other sites
oh ok that was the problem...now i only have to figure out why my MeshClass renders nothing :(

thx

regards,
m4gnus

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 14
• 14
• 45
• 22
• 27
• ### Forum Statistics

• Total Topics
634044
• Total Posts
3015211
×