Trying to create console with AllocConsole()
I'm creating a console window with AllocConsole(), and MSDN says it sets up the standard handles; but when I use printf or cout nothing is printed. Whats the deal?
Thanks
You will have to redirect all of the output streams as well. Here is a GameDev post that provides a complete solution for doing this [wink]
You also must include:
#include <fcntl.h>
#include <io.h>
You also must include:
#include <fcntl.h>
#include <io.h>
Awesome! Thanks for the reply so early in the morning. Now I have to put this is a new thread don't I... :(
Quote:Original post by M4573R
Awesome! Thanks for the reply so early in the morning. Now I have to put this is a new thread don't I... :(
Nope, all you do is call the code from any thread you want, that's it. It is very easy to use and requires no extra work!
For some reason my link got messed up, this post was the one I was trying to link to. Weird, GD is messing up my links, either way it is mfawcett's reply that I was pointing to.
But if I don't want my game to freeze while accepting input, it needs to be in its own thread. Right?
Handling input doesn't inherently require a new thread. In particular, using window messages for input works in the same thread as the message loop.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement