Code:
sprintf(buf1,"\nWinsock Ver Requested: %d %d",HIBYTE(ws.wVersion),LOBYTE(ws.wVersion));
sprintf(buf2,"\nWinsock Ver Available: %d %d",HIBYTE(ws.wVersion),LOBYTE(ws.wVersion));
sprintf(buf3,"\nCurrent WinSock Implementation:%s",&ws.szDescription);
sprintf(buf4,"\nSystem Status: %s",&ws.szSystemStatus);
sprintf(buf5,"\nMaximum Sockets: %u",ws.iMaxSockets);
sprintf(buf6,"\nMaximum message size: %u",ws.iMaxUdpDg);
strcat(strcat(strcat(strcat(strcat(strcat(buf,buf1),buf2),buf3),buf4),buf5),buf6);
another approach to avoid the strcat's is to sprintf into a single buffer with a moving index, since sprintf returns the number of characters written. also, might want to use snprintf to be safe(r) from overrun.
Code:
char buff[1000];
int i;
WSAStartup(0x0101,&ws);
buf[0]="";
i = 0;
i += sprintf(&buff[i],"\nWinsock Ver Requested: %d %d",HIBYTE(ws.wVersion),LOBYTE(ws.wVersion));
i += sprintf(&buff[i],"\nWinsock Ver Available: %d %d",HIBYTE(ws.wVersion),LOBYTE(ws.wVersion));
i += sprintf(&buff[i],"\nCurrent WinSock Implementation:%s",&ws.szDescription);
i += sprintf(&buff[i],"\nSystem Status: %s",&ws.szSystemStatus);
i += sprintf(&buff[i],"\nMaximum Sockets: %u",ws.iMaxSockets);
i += sprintf(&buff[i],"\nMaximum message size: %u",ws.iMaxUdpDg);