• Advertisement
Sign in to follow this  

Newbish stdout question :)

This topic is 4362 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
What IDE are you using? Most provide an immediate output window to which you can send whatever you wish. Other IDE's also allow you to set a watch on variables, etc. to see their current state.

Share this post


Link to post
Share on other sites
I personally use a combination of OutputDebugString() and XML log files. You can compose output for either method using std::wostringstream or StringCchPrintf() (+friends)...

hth
Jack

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
Sign in to follow this  

  • Advertisement