I’m pretty new to c++ and trying some sockets programming. My problem with this is, that i can’t get x = recv((SOCKET)this->sock, ausgabe, 1000, 0); to only return one line at a time, the lines are splitted by \n\r.
i’ve tried stuff like:
char * pos;
pos = strstr(ausgabe, "\n");
while(pos != NULL){
std::cout<< pos;
pos = strstr(pos, "\n");
}
but this would not work as expected. I hope you know this problem and got a solution to help me.
Greetings,
Frederick
You can use token library:
Demo: http://codepad.org/DYL1bjtb
For more information on tokenization http://www.cplusplus.com/reference/clibrary/cstring/strtok/