# 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 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 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 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 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 on other sites
OutputDebugString() works great. I'll just wrap it to take a std::string.

Quote:
 Original post by jpetrieIf 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]

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628350
• Total Posts
2982211

• 10
• 9
• 24
• 11
• 9