Annoying stdio redirect

Hi,

I’ve been trying to code up a small tech demo for geometry shaders for the past
few hours, but I’m running into a bit of a snag. The program is supposed to be
command-line and I’d like stdio to not redirect into a text file but rather into
the current command prompt.

So I tried using freopen(“CON”, “wb”, stdout). It didn’t redirect to stdout.txt,
but it didn’t use the command prompt either. Then I tried compiling from scratch
with --disable-stdio-redirect passed to configure. Once again, didn’t it didn’t
use stdio.txt, but it didn’t use the command prompt either.

Commenting out everything related to SDL and the #include <SDL.h> part restores
output to the command prompt though. :frowning:

Source code: http://www.nomorepasting.com/getpaste.php?pasteid=1305

Any ideas?
Michael Summers

Oh embarrassing. I just realized I wasn’t passing -mconsole
to the linker. I’ve done this before too now that I think
about it. sigh

Michael

Hi,

if I’m not mistaken, SDL_main() is the one to blame for the
redirection.

You should use a different device, CON won’t work.

Check
http://comsci.liu.edu/~murali/win32gui/Win32Apps.htm

Cheers,
Paulo

Quoting Michael Summers :> Hi,

I’ve been trying to code up a small tech demo for geometry shaders for the
past
few hours, but I’m running into a bit of a snag. The program is supposed to
be
command-line and I’d like stdio to not redirect into a text file but rather
into
the current command prompt.

So I tried using freopen(“CON”, “wb”, stdout). It didn’t redirect to
stdout.txt,
but it didn’t use the command prompt either. Then I tried compiling from
scratch
with --disable-stdio-redirect passed to configure. Once again, didn’t it
didn’t
use stdio.txt, but it didn’t use the command prompt either.

Commenting out everything related to SDL and the #include <SDL.h> part
restores
output to the command prompt though. :frowning:

Source code: http://www.nomorepasting.com/getpaste.php?pasteid=1305

Any ideas?
Michael Summers


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


This message was sent using IMP, the Internet Messaging Program.