Hello,
Moving to the C++ section for technical support / suggestion....
kc0arf
Posting Virtuoso
1,937 posts since Mar 2004
Reputation Points: 121
Solved Threads: 57
double a=123.456;
char msg1[3];
sprintf(msg1,"%g",a);
The stringmsg1 only has room for 2 characters and a terminating null. And you're trying to write 7 characters plus the null to it.
send(sockfd2,msg1,sizeof(msg1),0);
You might meanstrlen(msg1).
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314