Sign in to follow this  

stderr.txt and stdout.txt files

This topic is 4729 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 can't seem to figure out how to fix a problem with the stdout.txt and stderr.txt files. 1) Is their a way to have an option whether to use stderr.txt/stdout.txt or console? 2) Whenever I run a SDL prog, it puts everything into stdout.txt, (like it should), but the prog crashes. stdout.txt properties reveal it holds 4096 bytes (4 kilobytes) (on disk) If I add a printf("########################################"); the end 40 chars are removed, and if I look at stdout.txt, it shows 4096 bytes on disk. How do I fix it so it outputs more than 4096 bytes on disk. My program used to, and I can't think of anything that I changed to do this. Can you think of anything that can affect that? Thanks in advance

Share this post


Link to post
Share on other sites
1) Link with SDLmain_nostdio.lib instead of SDLmain.lib to prevent it from routing stdout/stderr to the text files.

2) Call fflush() on stdout and stderr after each time you write to them, or you can try setbuf(stdwhatever, NULL) to disable buffered output. I've never played with setbuf before, so I hope there won't be any complications :)

Share this post


Link to post
Share on other sites
The fact that your file is showing up as 4096 bytes whether or not you change what is output to it a little is not an error. Unlike RAM, which is broken into blocks of one byte each, hard drive space is split in 4 KB blocks, and 4 KB = 4096 bytes. All files take up a minimum of 4 KB each on disk. In windows, if you open the properties tab for a file, there are two different sizes that it gives for the file -- the actual file size, which is labeled "Size:", and the amount of hard disk space the file is using, which is labeled "Size on disk:" and is always a multiple of 4096 bytes. You have been looking at the "Size on disk:". If you want to know how much actual data is in the file, check the thing above "Size on disk:". (This is all based on my XP machine, but as I recall the same information is available under 95, 98, etc.) None of this means that your program isn't still screwed up of course, but don't be freaked out by the size thing.

Share this post


Link to post
Share on other sites

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