This is something I don't really understand. I pass a string to a server process via TCP/IP (that's not really important though). Anyway, on the server we do something like
Code:
char buf[16];
if(sscanf(s,"%*s %s",buf)!=1) {
printf("assignment failed\n");
}
else {
printf("assignment ok... buf=%s",buf);
}
Now at first I send s to be:
KEY
I get something like "assignment of... buf= @". I hit a space after KEY, the same tihng. I get two or three spaces and i get assignment failed.
No if after that I send a simple KEY with no spaces i always get an assignment failure.
Same thing happens if i send a normal string:
KEY VAL
and then give the bad ones, i get a failure on aech following bad one.
Any idea? Could this be a bug?