Avoid redirecting stdout/stderr

Hi,

is it possible to avoid redirecting stderr/stdout to
files : stdout.txt and stderr.txt
for win32 … i’ve tried everything and it seems to be
somehow ‘locked’ to file…

i’d really like it if i could do without modifying the SDL
source code or distributing SDL_main.c with my program

i see why it may be required to output to file, but it
certainly would be nice if there is a way to avoid this

Thx, Nehal

Hrm. I believe inside the Visual C++ project that comes with SDL there
is a SDL_nostdio target you can build which does what you want™.On Mon, 2002-11-11 at 01:48, Nehal Mistry wrote:

Hi,

is it possible to avoid redirecting stderr/stdout to
files : stdout.txt and stderr.txt
for win32 … i’ve tried everything and it seems to be
somehow ‘locked’ to file…

i’d really like it if i could do without modifying the SDL
source code or distributing SDL_main.c with my program

i see why it may be required to output to file, but it
certainly would be nice if there is a way to avoid this

If you define “NO_STDIO_REDIRECT” and recompile SDL, I think it will fix the
problem.

Ty> ----- Original Message -----

From: drevil@warpcore.org (EvilTypeGuy)
To:
Sent: Monday, November 11, 2002 10:48 AM
Subject: Re: [SDL] avoid redirecting stdout/stderr

On Mon, 2002-11-11 at 01:48, Nehal Mistry wrote:

Hi,

is it possible to avoid redirecting stderr/stdout to
files : stdout.txt and stderr.txt
for win32 … i’ve tried everything and it seems to be
somehow ‘locked’ to file…

i’d really like it if i could do without modifying the SDL
source code or distributing SDL_main.c with my program

i see why it may be required to output to file, but it
certainly would be nice if there is a way to avoid this

Hrm. I believe inside the Visual C++ project that comes with SDL there
is a SDL_nostdio target you can build which does what you want™.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

My apologies - the answer I gave before will not work.

Take a look at this thread in the mailing list archive:
http://www.libsdl.org/pipermail/sdl/2002-February/042180.html

Also, take a look at SDL_console: http://sdlconsole.tuxfamily.org/

Ty> ----- Original Message -----

From: @Tyler_Seymour (Tyler Seymour)
To:
Sent: Monday, November 11, 2002 11:19 AM
Subject: Re: [SDL] avoid redirecting stdout/stderr

If you define “NO_STDIO_REDIRECT” and recompile SDL, I think it will fix
the
problem.

Ty

If you define “NO_STDIO_REDIRECT” and recompile SDL, I think it will fix the
problem.

Ty

Hi,

is it possible to avoid redirecting stderr/stdout to
files : stdout.txt and stderr.txt
for win32 … i’ve tried everything and it seems to be
somehow ‘locked’ to file…

i’d really like it if i could do without modifying the SDL
source code or distributing SDL_main.c with my program

i see why it may be required to output to file, but it
certainly would be nice if there is a way to avoid this

Hrm. I believe inside the Visual C++ project that comes with SDL there
is a SDL_nostdio target you can build which does what you want™.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

These are not options, i want it to display to screen for everyone
using this program, not just me, so like i said, is there a way

Thx, Nehal>----- Original Message -----

From: “DrEvil”
To:
Sent: Monday, November 11, 2002 10:48 AM
Subject: Re: [SDL] avoid redirecting stdout/stderr

On Mon, 2002-11-11 at 01:48, Nehal Mistry wrote:
from my program,without recompiling SDL ?

These are not options, i want it to display to screen for everyone
using this program, not just me, so like i said, is there a way

You don’t need to recompile SDL, only SDLmain, that is anyway included
in your executable (not in the DLL or the .so). The best thing IMHO is
directly include the compilation of SDLmain in your project.

Bye,
Gabry> from my program,without recompiling SDL ?

Nehal Mistry wrote:

Hi,

is it possible to avoid redirecting stderr/stdout
to

files : stdout.txt and stderr.txt
for win32 … i’ve tried everything and it seems to
be

somehow ‘locked’ to file…

i’d really like it if i could do without modifying
the SDL

source code or distributing SDL_main.c with my
program

i see why it may be required to output to file, but
it

certainly would be nice if there is a way to avoid
this

These are not options, i want it to display to
screen for everyone
using this program, not just me, so like i said, is
there a way

If I understand the problem correctly, you have
messages going to stdout and stderr in your code.
Currently, in your Windows build, this output is being
written to two files called stdout.txt and stderr.txt.
Instead of the files, you would prefer all users to
see the messages as the program is running in a
console (Dos-like Window).

If this is what you want, then the problem is not with
SDL, but normal behavor for a Windows application. You
might notice that if you create a brand new project in
VC++6, that you can select from a range of different
types of applications. The two most basic
(no-frills)are Windows Application and Console
Application. The major difference between the two that
the Console Application pops up a Console while
running (where you can see stdout/stderr output) where
the other does not (and writes the .txt files).

Since you already have a project created, the easiest
thing to do is figure out what the differences are in
the compile switches and change your project to match.
I don’t know if Microsoft routinely changes these
switches, but in my version, go to
Project->Settings
Select the C/C++ tab (Category: General) and find
"Preprocessor Definitions"

Change the _WINDOWS to _CONSOLE and recompile.

(I usually use _CONSOLE for the Debug build and
_WINDOWS for Release build.)

Hope this helps,
Eric> from my program,without recompiling SDL ?


Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

If I understand the problem correctly,
Instead of the files, you would prefer all users to
see the messages as the program is running in a
console (Dos-like Window).

Correct!

If this is what you want, then the problem is not with
SDL, but normal behavor for a Windows application. You
might notice that if you create a brand new project in
VC++6, that you can select from a range of different
types of applications. The two most basic
(no-frills)are Windows Application and Console
Application. The major difference between the two that
the Console Application pops up a Console while
running (where you can see stdout/stderr output) where
the other does not (and writes the .txt files).

Actually, the problem IS with SDL. SDL redirects the output to file,
not windows. Any other program would print stdout/err to screen.
Or at least it is for mingw …
Also i am not using vc++, im using mingw only.

I can redirect to a “new” console window by adding these lines
before SDL_Init is called:

AllocConsole();
freopen("CON", "w", stdout);
freopen("CON", "w", stderr);

now if someone can figure out how to do this
without opening a new window, (eg, just write to the calling
window) that would be great

Change the _WINDOWS to _CONSOLE and recompile.

(I usually use _CONSOLE for the Debug build and
_WINDOWS for Release build.)

Hi, i couldn’t do all that, but i tried defining _CONSOLE but
it didn’t help at all…

Nehal

En r?ponse ? Nehal Mistry :

Hi,

is it possible to avoid redirecting stderr/stdout to
files : stdout.txt and stderr.txt
for win32 … i’ve tried everything and it seems to be
somehow ‘locked’ to file…

i’d really like it if i could do without modifying the SDL
source code or distributing SDL_main.c with my program

i see why it may be required to output to file, but it
certainly would be nice if there is a way to avoid this

Thx, Nehal

you must compile as a console-based program, not windowed one.

sylvain

At 03:23 PM 11/11/02 -0800, you wrote:

now if someone can figure out how to do this
without opening a new window, (eg, just write to the calling
window) that would be great

Recompile SDL, using the compile-time option “–disable-stdio-redirect”.–
“It startled him even more when just after he was awarded the Galactic
Institute’s Prize for Extreme Cleverness he got lynched by a rampaging mob
of respectable physicists who had finally realized that the one thing they
really couldn’t stand was a smart-ass.”
– Hitchhiker’s Guide to the Galaxy

Actually, the problem IS with SDL. SDL redirects the

output to file,
not windows. Any other program would print
stdout/err to screen.
Or at least it is for mingw …
Also i am not using vc++, im using mingw only.

I can redirect to a “new” console window by adding
these lines before SDL_Init is called:

AllocConsole();
freopen(“CON”, “w”, stdout);
freopen(“CON”, “w”, stderr);

now if someone can figure out how to do this
without opening a new window, (eg, just write to the
calling window) that would be great

I’ve don’t use mingw so I know little about it. A
quick google search yielded the following which looks
like it came from SDL mailing list.

"> ----- Original Message -----

From: <nwagenaar_at_digitaldynamics.nl>
To: <sdl_at_libsdl.org>
Sent: Saturday, February 16, 2002 4:50 PM
Subject: RE: [SDL] SDL 1.2.3 and cygwin under win98


When I want to compile a WIN32 version of my SDL
program and I want
to use console output (which standard is not done but
put in the
stdout.txt and stderr.txt files) I use the following
in my Makefile:

LIBS = -Dmain=SDL_main -L/lib/mingw -lcygwin -lSDLmain
-lSDL -lwinmm
-lmsvcrt -lcrtdll

If I want to use stdout.txt and stderr.txt I use the
following :

LIBS = -L/lib/mingw /usr/local/bin/sdl-config --libs
-lcrtdll


"


Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2