[SDL] I/O problem (stdio and stderr redirection to txt files)
bkropf at emich.edu
Thu Mar 17 11:03:28 PST 2005
Martin Storsjö wrote:
> On Wed, 16 Mar 2005, Brian Kropf wrote:
>> I believe the IO redirection is there on windows because when a
>> program writes to stdout or stderr it'll open up a cmd / DOS window,
>> which can disturb the same users that an earlier poster was talking
>> about. Many (non-programmer) users on windows try to stay away from
>> the command line interface and are confused when their windows
>> application is suddenly opening other windows when they haven't asked
>> for them.
> There seems to be a lot of misconecptions about this. In fact, whether
> a console window is showed or not hasn't got anything to do with if
> you write anything to stdout/stderr. The only thing that matters is if
> you link your program as a console or gui application.
It isn't a misconception. You are correct that normal programs linked as
gui applications don't have the stdio active, or open a console window.
You can however allocate a console to a gui window and have the stdio
handles available, you can also have a console mode program that links
with the gui libraries that has windows and stdio handles, there are
many ways to have stdio + windows. But the problem that we were talking
about is with how SDL handles things on windows. If you build SDL with
the redirection on, then when your user program tries to do something
like reading from stdin, it can't because of the redirection.
> If you link your your program as a gui application, no console window
> is showed, and whatever you write to stdout/err simply goes nowhere.
> Which imo is the solution that would be the best default.
> I always link my SDL applications with a version of SDLmain compiled
> without stdio redirection.
That's exactly what we have been talking about. The default behavior on
windows is redirection, and since the various applications using SDL out
there have varying usage of stdio (like error messages), the thought was
to do something that makes all platforms consistent.
> // Martin
> SDL mailing list
> SDL at libsdl.org
More information about the SDL