Hi with the following code
int a, b;
while ((n = readline (connfd, buf, sizeof(buf)-1)) > 0)
{
buf[n] = '\\0';
if \(sscanf\(buf,"%d %d",&a,&b\) != 2\)
snprintf \(buf, sizeof\(buf\), "data error\\r\\n"\);
else
\{
printf\("\\nRecvd %d and %d",a,b\);
snprintf \(buf, sizeof\(buf\), "%ld\\r\\n", a\+b\);\}
when i check the values "a" gets "0" whereas b gets the correct value. i tried this code outside it works fine out side in independent prog... I am using cygwin.
dataformat in buf = intSPACEint\r\n
---------- Post updated at 02:46 PM ---------- Previous update was at 02:39 PM ----------
ooh its working fine now with the above code.. i was using unsigned short a,b; instead of int ... and %u to get unsigned values....
However it is strnage it doenot use unsigned short ...
thanx for having a look