Sdl 1.2.9 on mingw, stdout.txt not really line buffered?

Hi All,

I’m now porting a multimedia app to SDL 1.2.9 (using binary
distribution from the site). I can now run and get some basic
functionality. FYI it took about 6 hrs to get my custom makefiles /
link build correct under mingw:
gcc … … -o my.exe -Wl,-Bdynamic -lmingw32 -lSDLmain -lSDL -mwindows

I’m using printf extensively for debug and notice stdout.txt and
stderr.txt are created when I run my app. However output to
stdout.txt is not flushed per-line as it should be - I checked the
source and buffering should should be per-line?

http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/main/win32/SDL_win32_main.c?rev=1.12&content-type=text/x-cvsweb-markup

ref:
setvbuf(stdout, NULL, _IOLBF, BUFSIZ);

However, the behavior I see, is that stdout.txt is only written when
the app exits successfully. If the app is killed or hangs then killed
or etc, then file size of stdout.txt is zero. Not so good for debug.

Note, stderr seems OK - no buffering. So now I am only using stderr.

Is this a mingw issue?

You might try fflush(stdout).

ChrisOn 3/29/06, J C wrote:

I’m using printf extensively for debug and notice stdout.txt and
stderr.txt are created when I run my app. However output to
stdout.txt is not flushed per-line as it should be - I checked the
source and buffering should should be per-line?


E-Mail: Chris Nystrom
http://www.newio.org/
AIM: nystromchris