• Non-blocking input like srcds
    6 replies, posted
In the Source Dedicated Server console you can enter commands while the output continues above it. I'd like to make a simple chat program that does exactly this. While typing a new message at the bottom of the screen, incoming messages keep appearing above it, without interrupting the input. How would I go about doing this? I know I can get non-blocking input with _kbhit( ), but how would I keep the input at the bottom and output on top of that?
use wndproc
I asked this once on Stack Overflow and everyone recommended I use console libraries to do it ([url]http://stackoverflow.com/questions/849876/c-simultanous-console-input-and-output[/url])
You could do this with multiple threads too.
[QUOTE=Cathbadh;16405608]You could do this with multiple threads too.[/QUOTE] The problem with that is that if the console outputs something while the user is writing the input will be lost, concatenated to the output.
[QUOTE=Xeon06;16412715]The problem with that is that if the console outputs something while the user is writing the input will be lost, concatenated to the output.[/QUOTE] That's certainly what srcds does, hurr.
[QUOTE=Xeon06;16412715]The problem with that is that if the console outputs something while the user is writing the input will be lost, concatenated to the output.[/QUOTE] Not entirely true. Take windows' telnet as an example, it constantly polls keys and prints output at the same time. If output happens to print out in the middle of your input, the input isn't lost or concatenated to the output at all. Of course I believe this is implementation specific, if you poll and buffer your own keys, you won't lose your input. As for the original question, I haven't experimented with this type of input/output scenario, but I believe [url]http://msdn.microsoft.com/en-us/library/ms685113(VS.85).aspx[/url] and everything related to that would be your best bet on a windows platform.
Sorry, you need to Log In to post a reply to this thread.