Jump to content
  • Advertisement
Sign in to follow this  
SirSmokey

Creating a second console

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

Ok how do I create a second Win32 console? I've searched on these forums and MSDN and AllocConsole() looks like a good start but it doesn't create another console window, it just uses the one that opens (that is to say when I call FreeConsole() the window closes and the app ends) So how can I create 2 console windows. I would like to use one to display debugging info. Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
You can, however, spawn a new process with an attached console and use pipes to send debug information to the second process. The second process could be relatively simple; just something like:

#include <iostream>
int main(int, char **) {
std::cout << std::cin.rdbuf();
return 0;
}

You could probably modify the code in this article to do the process creation. Just keep in mind that you don't want to set the new pipe handles to be the stdin/stdout of the current process and you'll need to keep at least one handle around to write your debug text to.

Share this post


Link to post
Share on other sites
Thanks for the article. Unfortunately I can't seem to get it working the way i want, there's som stuff i don't quite understand. Could anybody give me some quick sample code that would just, say, write a string to the second console from the first, something simple like that. If i saw it in action the way i would like, i think i would be ok and be able to take what i need to learn from it. Thanks for any help.

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!