[SDL] I/O problem (stdio and stderr redirection to txt files)
David Olofson
david at olofson.net
Wed Mar 16 11:07:16 PST 2005
On Wednesday 16 March 2005 18.25, 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.
Another reason might be that some platforms simply don't have any
useful implementation of stdout and stderr.
Anyway, just today, after cross compiling some stuff, I found myself
wondering for a moment where the output went... *heh*
> 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.
One solution is to implement something like the startup console that
most Q3 based games pop up. However, next, people will want it themed
and whatnot, so I guess that's better done as an add-on library...
The normal solution in desktop environments is to pop up a message
dialog when there is a problem, but that's not really compatible with
the stdout/stderr interface...
> I myself have mixed feelings about the redirection. I see it's
> usefulness, but wish there would be some message when sdl crases.
That's two different things, actually;
1) critical internal SDL errors, and
2) application output through stdout and stderr.
In the case of 1), sure; if it's something the application *cannot*
trap and handle appropriately, one would expect SDL to do what's
expected on the respective platform. That is, the SDL parachute
should pop up a dialog on platforms that have no "natural" stderr
channel. Preferably, the error message should be very clear, so the
user at least understands that something went very wrong and the
application wasn't even able to say anything about it.
As for 2), I think it's basically a bad habit to just print messages
to stdout or stderr regardless of platform. Unfortunately, it's the
only easy and portable way, so everyone keeps doing it. No matter how
trivial it may be to pop up a message dialog on Win32, Mac OS X or
whatever, it's kinda' tricky to implement and test it if you don't
have access to those platforms.
Either way, 2) is still something that can - and probably should - be
handled by an add-on library.
Just a thought, BTW: Would it make sense to try to open a "minimal
requirements" SDL window and use that as a startup console, and for
displaying error messages when you can't open a display with the
intended parameters?
That is, how likely is it that you hit a problem that prevents you
from opening up *any* kind of SDL display?
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
--- http://olofson.net --- http://www.reologica.se ---
More information about the SDL
mailing list