c++ - Asynchronous input and output/Get input after prefix -
i'm searching function print string before input made. know possible printf
, gets
, want string stay on last line input given. output handled in main thread, input handled in thread started main thread.
for example current console window (i have input stop
-command, '>' prefix string):
[12:00:00] starting server... >stop
when console outputs new line, want input on bottom line, this:
[12:00:00] starting server... [12:00:01] server started >stop
i using embarcadero c++builder xe2 win32 , vcl support.
edit: i'm using code, resulting in printing output after '>' prefix:
char buf[256]; printf(">"); gets(buf);
what looking called asynchronous input/output.
what did accomplish keeping track of each key being pressed , append string.
when press backspace deletes last character added string , when press enter submit current command.
when output comes along clear line typing on, print output, , move cursor down , print out had saved in string.
you have little work threading if want i'm pretty sure able accomplish of without effort.
other possible resources:
Comments
Post a Comment