Archived

This topic is now archived and is closed to further replies.

moople

C++ CIN stream

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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().

Share this post


Link to post
Share on other sites