Sign in to follow this  
nbertoa

VS2008 + SDL + stdout.txt stderr.txt

Recommended Posts

Hi gamedev comunnity I configured Visual Studio 2008 to make SDL programs. I create Win32 Windows Application and I write an SDL program that has a line fprintf(stdout,.... and other line fprintf(stderr,.... When I execute the program, supposedly I have to look at the project folder a file called stdout.txt but it isn't. If I create Win32 Console Application I can see fprintf messages at console. How can I obtain stdout.txt and stderr.txt in my project folder?? Do I need to create Windows or Console application if I will work with SDL and OpenGL??? Thanks

Share this post


Link to post
Share on other sites
The stdout.txt and stderr.txt files are only generated when I compile my windows SDL programs with MinGW (GCC). When compiling the same program with Visual Studio these files are not generated.

I don't know wheter there is a way to make Visual Studio compile the executable in a way that these files will be generated but normally you should not need these files anyway since there are most likely only used for debugging purposes in which case setting the subsystem to console while developing should be enough.

Share this post


Link to post
Share on other sites
I believe for SDL it is always a Win32 console project.

I was having the same problem with fprintf. The files wouldn't generate. I just used C++'s file I/O to solve this problem.

Share this post


Link to post
Share on other sites
Well stdout is by default redirecting output to the screen, if you have a console screen with your application then it will output it to that console. Or you can do I/O redirection and redirect it to a file like this on the command line. myProgram.exe > output.txt

Edit:

Or you can create your own to redirect the output to a file.

FILE *f = fopen("myfile.txt", "w");
fprintf(f, "%s", "hello world\n");
fclose(f);

[Edited by - nhatkthanh on May 9, 2008 1:37:14 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Nikko_Bertoa
Thanks I like stdout to Console, but Can I make a project SDL/OpenGL, with Win32 Console Application????


for simplicity's sake you might try opening your own "out" and "err" files, say in c:\err.txt and c:\out.txt ... for development that should "just work" and for something you release you don't really want it creating random files anyway.

I don't know/use visual studio (I use wxDev-C++)

(edit: just noticed nhatkthanh said pretty much the same thing ... and Trenki's answer seems best; I need to work on my "skimming comprehension" ;) )

Share this post


Link to post
Share on other sites

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