Jump to content
  • Advertisement
Sign in to follow this  

VC++ logging to file problem.

This topic is 5024 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

I'm using VC++ (Vis Studio 2003) to log the activity of part of my program out to a text file so I can view it later. This works absolutely fine when run in 'Debug' mode, however when I find the executable directly in my file system (in the 'debug' folder tha VisStud sets up, nothing is written to the file, the old one remains as is. Is there any reason why this would be the case?

Share this post

Link to post
Share on other sites
Just a thought - are you using an absolute or relative filepath?

When you run a program whilst in the VC editor, it runs it from the parent directory. When you run the executable, it runs it from the debug directory.

Let's try an example:

Directory Structure:

Let's say you've got something like:

std::string filename = "./Log/MyLog.txt";

Then when you run the program from VC, the current search directory is MyProject, and so it finds MyProject/Log just fine. When you run it from Debug, it's looking for MyProject/Debug/Log - which doesn't exist. Voila.

Of course, I may have misunderstood your question completely...


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!