Reading and writing data to console?

Is it possible to read and write data to a console window at the same time? Also, if it is, can you give an example?
What? Can you explain better?
I don't get it either... What do you mean? What exactly do you want to do?
I'm trying to make a console chat program, and at the moment only one person can talk at a time. If there was a way to read and write to the console at the same time, either user would be able to send messages whenever they wanted, not just after the other person spoke. Does that clarify it?
No, but you can create the illusion via some simple multiplexing and some simple Windows Console Functions to position the cursor and update things in the right places
http://www.google.com/search?btnI=1&q=msdn+Console+Functions

Just keep checking whether there is input from your socket(s) and from the console, and instantly respond to each one as it occurs, then return to your loop. There are Windows wait functions to do just this, such as WaitForMultipleObjects():
http://www.google.com/search?btnI=1&q=msdn+WaitForMultipleObjects

Hope this helps.
You can use the curses library,
so you can get the input by character while the user is typing and move the whole thing down if a new message arrives
Ok, thanks! I'll look into it.
Topic archived. No new replies allowed.