News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

SDL - output in console doesn't work

Started by Feuer, January 07, 2007, 09:24:38 PM

Previous topic - Next topic

Feuer

Hi there,
I create an new SDL project and everything is fine.
But, if I want an output trough printf or cout, nothing is in the console. Is there anything wrong, is it generally possible?

If you speak german, you can answer me in german :-)

Greetz

mandrav

I believe SDL redirects all output intended for stdout/stderr to files stdout.txt/stderr.txt. Check the folder your program runs in for those files.
Be patient!
This bug will be fixed soon...

Feuer

yeah, there is it, thanks

is it possible, that sdl redirect it in the console?

Phatency

Quote from: Feuer on January 07, 2007, 10:05:38 PM
yeah, there is it, thanks

is it possible, that sdl redirect it in the console?
Yes it is, just add the following lines to your code (after SDL_Init)
freopen("CON", "w", stdout); // redirects stdout
freopen("CON", "w", stderr); // redirects stderr


thomas

There is an even easier way.... SDL has some constant that you can #define so it does not redirect in the first place. I don't remember what the constant was, but it's in the docs somewhere.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Feuer