I have this function that reads from a tcp socket, but after I print the incoming message, no characters get printed in the printf() that follows, apart from the newline characters though for some reason.
void listenThread(void* context){ //context is a struct containing some userdata
printf("started listener thread\n");
struct clientdata *clientdata = context;
char* buff[128];
for (;;){
bzero(buff, sizeof(buff));
read(clientdata->sockfd, buff, sizeof(buff));
printf("\r%s", buff);
printf("\n\n[%s]> ", clientdata->username); //the two \n's get printed but the rest after doesn't.
}
}
I'm totally stumped and I'm convinced that the issue is glaringly obvious. Can anyone point me in the right direction?