Sign in to follow this  
TGPrankster

Win32 Console in a Win32 App

Recommended Posts

Hey again everyone. I've been working on rebuilding my game using some static libraries, and I'm trying to add a console window to the application so that I can easily get data from the application (for various reasons). I went to New Project (in Visual Studio '05) and created an empty Win32 Console Application, which I added to the main solution. I added a cpp file which I know works in it's own, but the console doesn't open with the main program! What do I need to do to get the console to work with the main application?

Share this post


Link to post
Share on other sites
You didn't need a new project. You merely needed a call to the Win32 API AllocConsole (and FreeConsole to close it).

If you wish to use C++ stream I/O redirected to that console, you will need to reopen (and/or duplicate) some low level file handles. See here for more information.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this