• Announcements

Archived

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

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 on other sites
Alternate between the two one character at a time.

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 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().

• Partner Spotlight

• Forum Statistics

• Total Topics
627681
• Total Posts
2978611

• 13
• 12
• 10
• 12
• 22