Sign in to follow this  

VC++ logging to file problem.

This topic is 4662 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:
MyProject
-Debug
-Log

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...

Jim.

Share this post


Link to post
Share on other sites

This topic is 4662 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this