Jump to content
  • Advertisement
Sign in to follow this  
MARS_999

How to get console window to show up for output

This topic is 2554 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

Under VC++ 2010 I need a console to stay active under the debug mode with a Windows project vs. a console project. Any ideas?

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
You can create a console window by calling AllocConsole(). However, if you just want to log debug messages, consider using OutputDebugMessage() instead.

Share this post


Link to post
Share on other sites

You can create a console window by calling AllocConsole(). However, if you just want to log debug messages, consider using OutputDebugMessage() instead.


Thanks for the reply. But I am not able to do std::cout << "HELLO"; and see any output....using AllocConsole()

Share this post


Link to post
Share on other sites

[quote name='SiCrane' timestamp='1311559400' post='4839807']
You can create a console window by calling AllocConsole(). However, if you just want to log debug messages, consider using OutputDebugMessage() instead.


Thanks for the reply. But I am not able to do std::cout << "HELLO"; and see any output....using AllocConsole()
[/quote]


Your application automatically attaches the streams for std::cout and std::cin when the program is started.

The console created using AllocConsole() has its own streams associated with it after it was created.

If you want to, it is not difficult to attach the global cout and cin streams to the new console.

Share this post


Link to post
Share on other sites
I usually just leave my code alone and switch the subsystem to console rather than create it programmatically. Then when I no longer need the console, I just switch back to windows subsystem.

I haven't tried this in VC++ 2010, but I would guess it still works in the latest version...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!