-
cin.getline and msgrcv
I posted this on the Linuxprogramming, but I thought id post it here since its C++ as well.
Anyways, Im working on this little chat program and the other programs should be able to communicate with each other, the only problem is with my cin.getline, i use that to enter in text, but it blocks, so it waits for the user to enter something in and then itll receive, even if the other user sent it before hand. my code is posted at the site below. Is there a way to check if cin.getline is true or false, i used an if statement but it didnt help, apparently cin.getline return *this, instead of 1 or 0. But here's my code, hope someone can help. Thanks!
http://sourcepost.sytes.net/sourcepo...ource_id=22467
-
Please do not post the same thing in more than one forum.
That said, this sounds like something that would be difficult to do in the console. You might want to look at this page from the faq.
-
Basically, you need to use whatever the OS gives you to read a character at a time, along with the ability to poll for input (if that is what you are doing).
When you've received a whole line, then you convert it to a C++ string and then you're back into normal C++ land.
But it's up to you to construct the bridge between them.
PS.
Your xpost is in the trash.