Hi Guys.
So here is the thing. I have a win32 / opengl application. I've created a class* that opens a console with AllocConsole and ties the stdin, stderr and stdout of the application to it.
So this is awesome, 'cos I can go (from anywhere in the program)
#include <iostream> ... std::cout << "\nSomething broke!"
Anyways, the point is I now have a console window that I can potentially get custom commands out of, such as "quit" for example.
I'm dubious about hacking something together before I've thought aboutt his so that's why I'm here.
If, on every frame (opengl) I go..
bool Frame() {
std::string _command;
std::cin >> command;
if( command == "quit")
return false;
else
return gfx->frame(); // do rendering
}
Then I'm never going to get to type "quit" because the program will always be recreating the string every seconds-per-frame.
So how do I solve that? I need some way of like holding a buffer of input characters and send/emptying it on a newline / null character? then have a vector of these ? How do I test it?
How I turn AllocConsole() and freopen("CONIN$", "r", stdin) into an interactive console?






