Archived

This topic is now archived and is closed to further replies.

object01

Need debugging console (NOT Quake-style)

Recommended Posts

I''m learning DirectX, and would like to have a console window to print debugging information to. After a lot of searching I found out about AllocConsole(), but cout and printf don''t affect it. No doubt I''m missing something. Bearing in mind that I''d rather not reformuate all my projects as console applications, how can I open and use a console window like this? -- Jeff S.

Share this post


Link to post
Share on other sites
Well, if STDOUT is redirected to the console anyway by AllocConsole(), why don''t cout and printf work for it? They write to STDOUT unless otherwise instructed, right?

--
Jeff S.

Share this post


Link to post
Share on other sites
if you want just something like an MS-DOS window, then just change the linker settings to have one. If you''re using MSVC++:

Project->Settings->Link

At the bottom text box, type:
/entry:WinMainCRTStartup
/subsystem:console

then you have an MS-DOS window that uses cout and printf. To change back to regular windows, replace console with windows

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by object01
Well, if STDOUT is redirected to the console anyway by AllocConsole(), why don''t cout and printf work for it?

AllocCOnsole does not redirect STDOUT, etc. Use freopen() as Dean posted above.

Share this post


Link to post
Share on other sites