Jump to content
  • Advertisement


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


Error stream

This topic is 5533 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 have a text stream for debugging, outputting to a file, initialized like this:
        //Removes old version of ErrorLog.txt

g_DebugText.open("ErrorLog.txt", ios::in | ios::out);	//Creates a new text file for read/write

Used like this:
void SetError(char * String)
    g_DebugText << String << endl;
And closed like this:
Normally it works fine, but suddenly, it doesn''t - I haven''t touched it. When I comment out SetError''s only line of code and output text using the << operator instead of a function call, it works. Otherwise, it just shows a blank text file. I am slowly but surely being driven insane by this problem. I''ve been debugging for two straight days, doing nothing else, and have absolutely no idea what''s going on. Help. Please. - TythosEternal PS - The older versions of the same program, with identical lines of code for the stream and the SetError function, work fine. "Who''s John Galt?"

Share this post

Link to post
Share on other sites
I didn''t look at your problem closely, but try hitting "Rebuild All". There is a REALLY annoying bug (feature perhaps?) that doesn''t always rebuild all code if you have it set to only compile changed source. I had a similar problem where i touched nothing and it stopped working. It had the most bizzare debug information while I was stepping through the code ;-D

Chances are this isn''t your problem, but its worth a shot.

My Lame Site

Share this post

Link to post
Share on other sites
is the program crashing? if it is, it might help to flush the log file''s buffer (g_DebugText.flush()) after every write. this will slow it down a bit, but if the app stops before the close() at least you won''t lose stuff that was buffered but not written yet.

Share this post

Link to post
Share on other sites
Tried the rebuild thing. If it worked, I would have puked out of sheer annoyance. I''m afraid it didn''t...

The program isn''t crashing, either. It runs fine - but something about that function is somehow clearing the stream, or preventing it from closing properly (now there''s a thought...). Of course, there''s only a SINGLE FRIGGIN'' LINE OF CODE, and goodness knows there''s not a lot wrong with it.

- TythosEternal

"Who''s John Galt?"

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!