• Advertisement

Archived

This topic is now archived and is closed to further replies.

FOPEN won't work no matter what

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

All I want to do is open text file ''tstfile.txt'' in the subdirectory ''data''. project\data\tstfile.txt that simple. I want to read the first string of text out of there, which is: data\hull.bmp but no matter where I tell file.open to get tstfile.txt from, it won''t open it and it will give me ''no file found'' message. code: fstream file; file.open( "data\tstfile.txt", ios::in/ios::nocreate ); if ( !file ) { MessageBox( NULL, "No File", "INFO", NULL ); return 0; } can somebody compile this, and run it to make sure it works?

Share this post


Link to post
Share on other sites
Advertisement


C/C++ uses ''\'' as an escape character for things like ''\n'' for newline and ''\t'' for tab. So when using it for path names you have to use \\. So you''d have "data\\tstfile.txt"


Andrew



Share this post


Link to post
Share on other sites

  • Advertisement