I
Index
Hi,
I am trying to compare a char* with an unsigned char*.I have type cast
the later to char*.Now the problem is, the unsigned char* is populated
with recv() function over the socket and sometimes it containes junk.I
need to compare the received message over the socket with a particular
charecter 'r' to terminate the entire process.
Any help will be highly appreciated.The code snippet and my output is
as follows:
if(!(strcmp(message,"q"))){
Close(clntSocket);
exit(0);
}
output screen:
The received message is :q©
Length of the received message 1
q©
** Though I typed q, the received message has a junk charecter at its
end and hence the comparison dosn't work.but sometimes after two/three
failed times, the string is without any junk charecter.
Thanks.
I am trying to compare a char* with an unsigned char*.I have type cast
the later to char*.Now the problem is, the unsigned char* is populated
with recv() function over the socket and sometimes it containes junk.I
need to compare the received message over the socket with a particular
charecter 'r' to terminate the entire process.
Any help will be highly appreciated.The code snippet and my output is
as follows:
if(!(strcmp(message,"q"))){
Close(clntSocket);
exit(0);
}
output screen:
The received message is :q©
Length of the received message 1
q©
** Though I typed q, the received message has a junk charecter at its
end and hence the comparison dosn't work.but sometimes after two/three
failed times, the string is without any junk charecter.
Thanks.