16,473
社区成员
发帖
与我相关
我的任务
分享
// TODO: code your application's behavior here.
CFile file;
CFileException e;
BOOL bOk = file.Open("C:\\abc\\yourname.txt",CFile::modeRead|CFile::typeBinary,&e);
if (!bOk)
{
if(CFileException::badPath == e.m_cause)
TRACE("错误文件路径\n");
}
int iLen = file.GetLength();
char* pData = new char[iLen+1];
file.ReadHuge(pData,iLen);
pData[iLen] = 0;
TRACE(pData);
delete [] pData;
CString strHello;
strHello.LoadString(IDS_HELLO);
cout << (LPCTSTR)strHello << endl;