getline fix in chat program

This commit is contained in:
Sam Mario Svensson 2013-11-19 14:59:00 +01:00
parent 816dced937
commit 58efe7fdd3
1 changed files with 8 additions and 1 deletions

View File

@ -59,10 +59,15 @@ void chat(Client client)
{
client.Recv(msgRecv);
cout<< "Server: " << msgRecv << endl;
cout<< "Client 2: " << msgRecv << endl;
cin.getline(msgSend , 255 , '\n');
if(strlen(msgSend) < 1)
{
strcpy_s(msgSend , " ");
}
if(msgSend != "exit")
{
client.Send(msgSend);
@ -73,6 +78,8 @@ void chat(Client client)
chatDone = true;
}
cin.clear();
}
}