65,211
社区成员
发帖
与我相关
我的任务
分享void __cdecl _CRT_DEBUGGER_HOOK(int _Reserved)
{
/* assign 0 to _debugger_hook_dummy so that the function is not folded in retail */
(_Reserved);
_debugger_hook_dummy = 0;
}ULONGLONG CStdioFile::Seek(LONGLONG lOff, UINT nFrom) { ASSERT_VALID(this); ASSERT(nFrom == begin || nFrom == end || nFrom == current); ASSERT(m_pStream != NULL);void CTest::printIntToFile(const std::string &str,int iPrint)
{
std::string strToPrint=str+boost::lexical_cast<std::string>(iPrint)+"\n";
CStdioFile cfLogOfFunc;
cfLogOfFunc.Open("C:\\Documents and Settings\\Administrator\\桌面\\logOfFunc.txt",CStdioFile::modeReadWrite|CStdioFile::typeText );
cfLogOfFunc.SeekToEnd();
cfLogOfFunc.WriteString(CString(strToPrint.c_str()));
cfLogOfFunc.Close();
}
void CTest::printLogToFile(const std::string &str,int iPrint)
{
std::string strToPrint=str+boost::lexical_cast<std::string>(iPrint)+"\n";
CStdioFile cfLog;
cfLog.Open("C:\\Documents and Settings\\Administrator\\桌面\\log.txt",CStdioFile::modeReadWrite|CStdioFile::typeText );
cfLog.SeekToEnd();
cfLog.WriteString(CString(strToPrint.c_str()));
cfLog.Close();
}void CTest::printLogToFile(const std::string &str,int iPrint)
{
std::string strToPrint=str+boost::lexical_cast<std::string>(iPrint)+"\n";
CStdioFile cfLog;
bool isOpenFileSuccess=false;
int i=0;
while (isOpenFileSuccess==false)
{
isOpenFileSuccess=cfLog.Open("C:\\Documents and Settings\\Administrator\\桌面\\log.txt",CStdioFile::modeReadWrite|CStdioFile::typeText );
i++;
}
cfLog.SeekToEnd();
cfLog.WriteString(CString(("\n\n\n\ni="+boost::lexical_cast<std::string>(i)).c_str()));
cfLog.WriteString(CString(strToPrint.c_str()));
cfLog.Close();
}
//example for CFile::Open
CFile f;
CFileException e;
char* pFileName = "test.dat";
if( !f.Open( pFileName, CFile::modeCreate | CFile::modeWrite, &e ) )
{
#ifdef _DEBUG
afxDump << "File could not be opened " << e.m_cause << "\n";
#endif
}