Archived

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

TythosEternal

Error stream

Recommended Posts

I have a text stream for debugging, outputting to a file, initialized like this:
  
remove("ErrorLog.txt");
        //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:
  
g_DebugText.close();
  
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