Sign in to follow this  
discman1028

Newbish stdout question :)

Recommended Posts

When programming graphics, I have usually used console applications, where I have the console as a nice separate window that I can send debugging info to. Well, now using Direct3D in a Win32 Application, I'm wondering what is used for real-time debugging, if not a console. Thanks.

Share this post


Link to post
Share on other sites
hi,

what blocks you from doing a win32 console application, and debug to the console? other choices are: logfile, win32 window that you can write text into, tcp/ip socket that floods debug output out if someone is connected (and you telnet onto that port), just to mention a few.

kp

Share this post


Link to post
Share on other sites
If you'd prefer to simply use an actual console window, like those you get in a console application, you can do the following early-on in your application:


// At startup...
AllocConsole();
freopen("CONOUT$","w",stdout);

// At shutdown...
FreeConsole();


The strange CONOUT$ string parameter is the name of the standard output handle.
This should allow you to use std::cout.

Share this post


Link to post
Share on other sites
OutputDebugString() works great. I'll just wrap it to take a std::string.

Quote:
Original post by jpetrie
If you'd prefer to simply use an actual console window, like those you get in a console application, you can do the following early-on in your application:


// At startup...
AllocConsole();
freopen("CONOUT$","w",stdout);

// At shutdown...
FreeConsole();



This works beautifully, too. And jpetrie, I'd up your rating, except it's looking pretty 1337. ;)

EDIT: Well, it changed... rating++ :)

Thanks!

[Edited by - discman1028 on March 17, 2006 11:00:40 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this