   Printf statement not generating 'stdout' file in Visual C++
  Hi gamedev,In my Win32 Console application project in Visual C++ 2008 Express Edition, I have put a printf statement like this (in debug mode):#include <stdio.h>...printf("SDL was initialized correctly");I am using SDL for this project.However, as the title says, no 'stdout' file is generated during execution of the application and I have no idea why. Countless google searches have led me to believe that there might be a problem with my project properties or that I'm maybe missing some component. If this might be the case, I'll post my settings etc. when I get home (using another computer for this thread). Additionally, fprintf does not work either. Thanks in advance!NordCoderNote: I'm a beginner in regards to Visual C++ configurations, so please explain things to me thoroughly :)   
  stdout isn't a file on the disk, it's usually printed to the console/output window.If you want to redirect stdout to a file, you can run your program with a command like: myProgram.exe > stdout.txtHow are you using fprintf?   ;Quote:Original post by NordCoderHi gamedev,In my Win32 Console application[...]That's the problem.  If you have a console application, all printf are shown in the application's console and SDL doesn't redirect anything to stdout.txt nor stderr.txt.If you want to have those files, then you must change the application to be a Windows application.  In Visual Studio this is done by selecting the "Windows" option in Properties, Linker, System, Subsystem.Once changed, the console window won't appear anymore and any printf statement (and, by extension, fprintf to stdout or stderr) are stored in the stdout.txt and stderr.txt files.Be aware that if you don't output anything at all SDL will remove those files when exiting the application.;  That was very helpful :)@ Hodgman: How would you do that: myProgram.exe > stdout.txt (the command prompt?) I'm using it like this:fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());@ summaky: I had already changed the subsystem to Windows, and as you say the console window does not appear. However, there is still no output file :(   ;Quote:Original post by NordCoder@ summaky: I had already changed the subsystem to Windows, and as you say the console window does not appear. However, there is still no output file :(Are you looking at the correct directory? If I remember correctly there should be created at the same directory where the executable is.Also, when the subsystem was set to Console, did the console actually show something? If not, then you won't get the output files when changing to subsystem Windows.;  No file is generated in the executable's directory. When set to 'Console' all output was displayed as intended...This is really frustating, but at least I can see the debug statements by switching to 'Console' :P   ;  Are you linking with libSDLmain? That's where the redirection happens.   ;  Yes, I am linking with 'SDLmain.lib'. However, if I remove it I get the following errors:1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup1>C:\Documents and Settings\Admin\Dokumenter\Visual Studio 2008\Projects\TextClassAndColorClassTest\Debug\TextClassAndColorClassTest.exe : fatal error LNK1120: 1 unresolved externals;Quote:Original post by NordCoderThat was very helpful :)@ Hodgman: How would you do that: myProgram.exe > stdout.txt (the command prompt?) I'm using it like this:*** Source Snippet Removed ***@ summaky: I had already changed the subsystem to Windows, and as you say the console window does not appear. However, there is still no output file :(Your redirection is wrong. If you are writing to stderr, you need to useyourApplication.exe 2> stderr.logor if you want both stdout and stderr output redirected to the same file:yourApplication.exe > stderr.log 2>&1Also, you should stop using C-style I/O. It's a bad habit among C++ programmers. Even if you do not like the syntax of C++ iostreams, you may want to take advantage of operator overloading when dumping objects to standard output...http://www.cplusplus.com/reference/iostream/   ;  @ majickthise: Sorry, but being still somewhat new to the IDE (and IDE's in general), could you please explain "yourApplication.exe 2> stderr.log" in more detail?I had no idea that printf etc. was C-style, so thanks for the heads up :) I'll be using the C++ iostreams from now on.   