Stdout e cout in Win32

(I’m using Win32, and I tryed console and windows compilation)

Is there a way to redirect std::cout to the file stdout.txt ?
With printf it works, but std::cout don’t…–
Bye!

in this i would be interested too!!

there is a solution to redirect cout to a fltk - textoutput-window,
but it is rather complicated, reimplementing the buffered working
principle of ostream. ( search for “fltk log” )
http://216.239.53.104/search?q=cache:DmmaKMevMQcC:www.fltk.org/
newsgroups.php%3Fs17%2Bgfltk.announce%2Bv22+fltk+log&hl=en&ie=UTF-8

isn’t there a simpler solution ?

“SkunkGuru” wrote:
(05/12/2003 11:22)>(I’m using Win32, and I tryed console and windows compilation)

Is there a way to redirect std::cout to the file stdout.txt ?
With printf it works, but std::cout don’t…


Bye!


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

Cool - i’ve tested it in release mode under visualc++ - and the
redirection works already in sdl, if you build a non-console project !!
Only with a console project cout outputs to the console. So - for me
everything is fine. Just try to switch off the console - go to the
linker settings and choose under system : “/SUBSYSTEM:windows” instead
of “/SUBSYSTEM:console” !!!

I’ve stopped 16.484 spam messages. You can too!
Get your free, safe spam protection at
http://www.cloudmark.com/spamnetsig/

-----Urspr?ngliche Nachricht-----Von: sdl-admin at libsdl.org [mailto:sdl-admin at libsdl.org] Im Auftrag von
smtp.andre-krause.net
Gesendet: Montag, 12. Mai 2003 15:48
An: sdl at libsdl.org
Betreff: Re: [SDL] stdout e cout in Win32

in this i would be interested too!!

there is a solution to redirect cout to a fltk - textoutput-window,
but it is rather complicated, reimplementing the buffered working
principle of ostream. ( search for “fltk log” )
http://216.239.53.104/search?q=cache:DmmaKMevMQcC:www.fltk.org/
newsgroups.php%3Fs17%2Bgfltk.announce%2Bv22+fltk+log&hl=en&ie=UTF-8

isn’t there a simpler solution ?

“SkunkGuru” wrote:
(05/12/2003 11:22)

(I’m using Win32, and I tryed console and windows compilation)

Is there a way to redirect std::cout to the file stdout.txt ? With
printf it works, but std::cout don’t…


Bye!


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


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

Cool - i’ve tested it in release mode under visualc++ - and the
redirection works already in sdl, if you build a non-console project !!
Only with a console project cout outputs to the console. So - for me
everything is fine. Just try to switch off the console - go to the
linker settings and choose under system : “/SUBSYSTEM:windows” instead
of “/SUBSYSTEM:console” !!!

As I said in my first message, I tryed both windows and console subsytem…
(I always use the windows subsyste, however…) and it doesn’t work…

This is my test program:

#include “SDL.h”
#include

int main(int argc, char *argv[]) {
printf(“i’m printf”);
std::cout << “i’m cout”;
return 0;
}

The stdout.txt file is only:
i’m printf

I’m using VC++ 6 with SP5, under WinNT 4 and WinME.
I’m using the latest version of SDL.–
Bye!

Cool - i’ve tested it in release mode under visualc++ - and the
redirection works already in sdl, if you build a non-console project !!

I’ve found the problem !!!

It WORKS in release mode BUT it DON’T WORKS in debug mode !!!

Now… I’d like to understand why… I didn’t change any compilation/linking
options…
any idea ?–
Bye!

Ok, i’m using visual studio 2003 … And i use stl and “using namespace
std;” - but i do not think that this is the reason…

I’ve stopped 16.484 spam messages. You can too!
Get your free, safe spam protection at
http://www.cloudmark.com/spamnetsig/

-----Urspr?ngliche Nachricht-----Von: sdl-admin at libsdl.org [mailto:sdl-admin at libsdl.org] Im Auftrag von
SkunkGuru
Gesendet: Dienstag, 13. Mai 2003 11:20
An: sdl at libsdl.org
Betreff: [SDL] Re: stdout e cout in Win32

Cool - i’ve tested it in release mode under visualc++ - and the
redirection works already in sdl, if you build a non-console project !!

Only with a console project cout outputs to the console. So - for me
everything is fine. Just try to switch off the console - go to the
linker settings and choose under system : “/SUBSYSTEM:windows” instead
of “/SUBSYSTEM:console” !!!

As I said in my first message, I tryed both windows and console
subsytem… (I always use the windows subsyste, however…) and it
doesn’t work…

This is my test program:

#include “SDL.h”
#include

int main(int argc, char *argv[]) {
printf(“i’m printf”);
std::cout << “i’m cout”;
return 0;
}

The stdout.txt file is only:
i’m printf

I’m using VC++ 6 with SP5, under WinNT 4 and WinME.
I’m using the latest version of SDL.


Bye!


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

i’ve tested it in release mode under visualc++
Ok, i’m using visual studio 2003 … And i use stl and “using namespace
std;” - but i do not think that this is the reason…

I use stl too (std::string for example).

Does your sample work only in release mode ?
Have you tryed the debug mode ?–
Bye!

If i use subsystem:windows in debug mode, my cout<<* output goes too
into stdout.txt !!

I’ve stopped 16.484 spam messages. You can too!
Get your free, safe spam protection at
http://www.cloudmark.com/spamnetsig/

-----Urspr?ngliche Nachricht-----Von: sdl-admin at libsdl.org [mailto:sdl-admin at libsdl.org] Im Auftrag von
SkunkGuru
Gesendet: Dienstag, 13. Mai 2003 12:45
An: sdl at libsdl.org
Betreff: [SDL] Re: Re: stdout e cout in Win32

i’ve tested it in release mode under visualc++
Ok, i’m using visual studio 2003 … And i use stl and “using namespace
std;” - but i do not think that this is the reason…

I use stl too (std::string for example).

Does your sample work only in release mode ?
Have you tryed the debug mode ?


Bye!


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

If i use subsystem:windows in debug mode, my cout<<* output goes too
into stdout.txt !!

That’s correct. SDL redirects output to a file so that you have a record
of it for bug reports (it wouldn’t go anywhere else otherwise). You can
modify this behavior by changing the define in SDL_main.c and rebuilding
SDLmain.lib

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment