Stdio redirect issue

Hi…

Everyone is probably expecting this to be about how to disable stdio redirect
but I’ve already figured that out. The issue I’m having is that while I can
disable stdio redirect (through compiling with --disable-stdio-redirect), it
seems to totally disable output. Now it won’t do either a text file or the
console. Any idea how to get it to output to the console?

I’m using version 1.2.11 under Windows XP compiling through MSYS/MinGW.

Thanks,
Michael Summers

I think you have to make a console yourself (because SDLmain provides
a WinMain which doesnt create a console ). The function to create a
console is AllocConsole() or something, and you can use freopen() in
some form to make the standard output/error files point to it…I’ve
heard this was the procedure but I havent tried it myself so there may
be additional steps.On 2/15/07, Michael Summers wrote:

Hi…

Everyone is probably expecting this to be about how to disable stdio redirect
but I’ve already figured that out. The issue I’m having is that while I can
disable stdio redirect (through compiling with --disable-stdio-redirect), it
seems to totally disable output. Now it won’t do either a text file or the
console. Any idea how to get it to output to the console?

I’m using version 1.2.11 under Windows XP compiling through MSYS/MinGW.

Thanks,
Michael Summers


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

I think you have to compile it as a console app, otherwise Windows will
disable console output. Use the -mconsole switch to do that.

~ GerryOn Thu, 15 Feb 2007 09:46:24 +0100, Michael Summers wrote:

Any idea how to get it to output to the console?

I’m using version 1.2.11 under Windows XP compiling through MSYS/MinGW.

Take a look at the second message at
http://forums.devarticles.com/c-c-help-52/two-conlose-windows-85718.html

and this site http://www.codeproject.com/cpp/MultipleConsoles.aspOn 2/15/07, Gerry JJ wrote:

On Thu, 15 Feb 2007 09:46:24 +0100, Michael Summers wrote:

Any idea how to get it to output to the console?

I’m using version 1.2.11 under Windows XP compiling through MSYS/MinGW.

I think you have to compile it as a console app, otherwise Windows will
disable console output. Use the -mconsole switch to do that.

~ Gerry


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

Gerry JJ <trick icculus.org> writes:

Any idea how to get it to output to the console?

I’m using version 1.2.11 under Windows XP compiling through MSYS/MinGW.

I think you have to compile it as a console app, otherwise Windows will
disable console output. Use the -mconsole switch to do that.

I had been trying the code below but it still wasn’t doing anything. I wouldn’t
have guessed I’d have to use -mconsole because I was running it from the console
rather than double clicking.

#if defined(__WIN32__)
freopen("CON", "wb", stdout);
freopen("CON", "wb", stdout);
#endif

Thanks for the help. :slight_smile:

Michael> On Thu, 15 Feb 2007 09:46:24 +0100, Michael Summers <wfrobozz gmail.com> wrote:

Hi i had the same problem in mingw.

I had to recompile the SDLMain lib with out the redirection

I attached my compiled lib file.
Use this file and your output should go to the console.

2007/2/16, Michael Summers :

Gerry JJ <trick icculus.org> writes:

Any idea how to get it to output to the console?

I’m using version 1.2.11 under Windows XP compiling through
MSYS/MinGW.

I think you have to compile it as a console app, otherwise Windows will
disable console output. Use the -mconsole switch to do that.

I had been trying the code below but it still wasn’t doing anything. I
wouldn’t
have guessed I’d have to use -mconsole because I was running it from the
console
rather than double clicking.

#if defined(__WIN32__)
> freopen("CON", "wb", stdout);
> freopen("CON", "wb", stdout);
> #endif

Thanks for the help. :slight_smile:

Michael


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

-------------- next part --------------
A non-text attachment was scrubbed…
Name: libSDLmain.a
Type: application/octet-stream
Size: 2805 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070216/15d95859/attachment.a> > On Thu, 15 Feb 2007 09:46:24 +0100, Michael Summers <wfrobozz gmail.com> wrote:

Hello !

Hi i had the same problem in mingw.

I had to recompile the SDLMain lib with out the redirection

Jup. This is correct under Windows
with MinGW and with VC you have to recompile SDLmain
to get the redirection you want.

CU