Archived

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

Chris Thomas

creating a logfile

Recommended Posts

hi, I''m trying to create a logfile in my game by simply using fprintf and outputing strings to a file. The main reason i''m doing this is to debug some parts of my network code to make sure that what i want to be sent is being sent. The problem I have is that if the program exits because of an error the logfile is left blank. It works fine when the program exits normally. Any help would be appreciated.

Share this post


Link to post
Share on other sites
If it''s completely blank, you''re probably not even calling fclose(). Everything will be flushed when you close the file. However, as was already suggested, you should also use fflush() occasionally in case you''re program crashes (in which case fclose() is definitely never called, and you''re logfile is blank).

Share this post


Link to post
Share on other sites