C++ CIN stream

Started by
2 comments, last by moople 22 years, 5 months ago
Hi Is there any way I can use the iostream so characters can be outputted to the screen while it is waiting for input? IN others words can I cout while im cin ''ing The reason I want this is because I have a coded a simple network chat program that is console based. Cheers
Advertisement
Alternate between the two one character at a time.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
use somethign like:

      void* OutputThread(){    while(1) // loop forever    {        cout << something; // data goes here    }}      

put that in a thread using CreateThread or something then just put a while(cin >> data) loop in your main()

hope that helps

Edited by - barazor on November 18, 2001 2:31:24 PM
However, you also want to be able to erase what you''ve typed (using the backspace key, right?)

cin and cout are not to be thought of as functions; they''re objects, which means they have methods (very useful methods) that can provide more refined behavior. Look into basic_istream::get(), basic_istream::putback() and basic_istream::read().

This topic is closed to new replies.

Advertisement