Why are standard output and errors messages written to stdout.txt and stderr.txt?

On Windows stdout and stderr are not connected to anything in GUI programs. So creating a GUI program (which means linking with -mwindows for mingw32) like:

#include <iostream>
#include "SDL.h"

using namespace std;

int main(int argc, char *argv[])
{
    cout << "Hello world." << endl;
    return EXIT_SUCCESS;
}

Would not be able to print anything. To solve this SDL redirects all output to two textfiles, stdout.txt and stderr.txt created in the working directory where your SDL program was started. Even though for console programs in windows this is not a problem, stdout and stderr are ALWAYS redirected. This is very nice for debugging but can be annoying at times.

See also: FAQ_Windows_Where_stdout_/_stderr

FAQ_Windows_Why_stdout_/_stderr (last edited 2008-04-17 08:18:14 by localhost)