Hello,
I have a buffer that contains words. However, the words comes from a client. I just want to get the words out. However, the buffer is being filled with rubbish after the words. Example "Manchester United&^&*#&#&##^&#@*&^^ etc.
How can I just get "Manchester United" out?
I have used the following using length and substring, but it displays everything
Many thanks,Code:char buffer[256]; sock.receiveFrom(buffer,sizeof(buffer), addr); std::string message = buffer; int strLength = 0; strLength = message.size(); std::cout << "The length of the string is: " << strLength << std::endl; message = message.substr(0,strLength); std::cout << message;
Steve




Reply With Quote