I thought we decided _open_osfhandle() wasn't working with sockets. I'd just use send():
Code:
sprintf(WINCOM,"%s %s %s %s %s","WIN", stations_1, channel, time_on, time_off);
send(ws_sockfd, WINCOM, strlen(WINCOM), 0);
Better yet, make yourself a sockPrintf():
Code:
int sockPrintf(SOCKET sock, LPCTSTR szFormat, ...)
{
TCHAR szText[4096];
va_list args;
/* Format the text into the buffer */
va_start(args, szFormat);
_vsntprintf(szText, sizeof(szText) / sizeof(szText[0]), szFormat, args);
szText[(sizeof(szText) / sizeof(szText[0])) - 1] = TEXT('\0');
va_end(args);
return send(sock, (char *) szText, lstrlen(szText), 0);
}
/* Sample usage: */
sockPrintf(ws_sockfd, "%s %s %s %s %s", "WIN", stations_1, channel, time_on, time_off);