// format input, convert to 8-bit and send. void nclog (const wchar_t *fmt, ...) { TCHAR StrW[1024]; va_list vl; va_start(vl,fmt); wchar_t buf[1024]; // to bad CE hasn't got wvnsprintf wvsprintf(buf,fmt,vl); if(bUseSocket) wsa_init(); char bufOut[512]; //insert data/time wsprintf(StrW, L"%s: %s", logDateTime(), buf); wsprintf(buf, L"%s", StrW); WideCharToMultiByte(CP_ACP,0,buf,-1,bufOut,400, NULL, NULL); RETAILMSG(1, (buf)); //moved from 1) if(iUseLogging==1){ #ifdef MYDEBUG wsa_send(bufOut); DEBUGMSG(1, (buf)); #else if(bUseSocket) wsa_send(bufOut); // 1) #endif writefile(buf); }//iUseLogging }
// format input, convert to 8-bit and send. void nclog (const wchar_t *fmt, ...) { va_list vl; va_start(vl,fmt); wchar_t bufW[1024]; // to bad CE hasn't got wvnsprintf wvsprintf(bufW,fmt,vl); #ifdef USEWINSOCK wsa_init(); #endif char bufOutA[512]; //add instance number HMODULE hMod = GetModuleHandle(NULL); WCHAR bufTmpW[512]; wsprintf(bufTmpW, L"0x%08x: %s", hMod, bufW); wsprintf(bufW, L"%s", bufTmpW); //convert to char WideCharToMultiByte(CP_ACP,0,bufW,-1,bufOutA,400, NULL, NULL); #ifdef USEWINSOCK wsa_send(bufOutA); #endif writefile(bufW); #ifdef DEBUG DEBUGMSG(1, (bufW)); #else RETAILMSG(1, (bufW)); #endif }
// format input, convert to 8-bit and send. int nclog (const char *fmt, ...) { va_list vl; va_start(vl,fmt); char buf[1024]; // to bad CE hasn't got wvnsprintf sprintf(buf,fmt,vl); wsa_init(); wsa_send(buf); return 0; }