int MSocket::Receive(CString& str, UINT uTimeOut, int nFlags) { //static char szBuf[5000]; AutoBuf szBuf(5000); memset(szBuf.p, 0, 5000); // If a timeout value was specified, set it if (uTimeOut > 0) SetTimeOut(uTimeOut); // Call base class function int nRet = CSocket::Receive(szBuf.p, 5000, nFlags); // If we previously set a timeout if (uTimeOut > 0) { KillTimeOut(); // If the operation timedout, set a more // natural error message if (nRet == SOCKET_ERROR) { if (GetLastError() == WSAEINTR) SetLastError(WSAETIMEDOUT); } } // Fill in the CString reference str = szBuf.p; return nRet; }
void KviWindow::outputNoFmt(int iMsgType, const QString & szText, int iFlags, const QDateTime & datetime) { QString szBuf(szText); preprocessMessage(szBuf); const QChar * pC = szBuf.constData(); if(!pC) return; internalOutput(m_pIrcView, iMsgType, (kvi_wchar_t *)pC, iFlags, datetime); }
void LoggerImple::WriteLogProcShareMem() { std::unique_ptr<TCHAR, void(*)(void*)> szBuf (new TCHAR[ItemBuffSize], [](void*p){ delete [] p; }); while (true) { int getted = 0; bool readRet = shareWriter_->Read(szBuf.get(), ItemBuffSize, &getted); if (readRet && getted) { bool ret = logFile_->WriteToFile(szBuf.get(), getted); } if (exit_ && !readRet) { break; } } }
////////////////////////////////////////////////////////////////////// // Methode : DWORD2String // Resume : Translate Dword to String // In : DWORD // Out : CString ////////////////////////////////////////////////////////////////////// CString DWORD2String(DWORD dw) { CString szBuf(""); szBuf.Format("%X", dw); return (szBuf); }