#if (USE_MODE==WINDOWS_API)
U32 NumBytesRead;
HANDLE hFile = CreateFile("D:\\My Documents\\桌面\\cmd.txt", GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
U32 FileSize = GetFileSize(hFile, NULL);
char * pFile = malloc(FileSize);
ReadFile(hFile, pFile, FileSize, &NumBytesRead, NULL);
MORRIS_TRACE((LPCSTR)pFile);
CloseHandle(hFile);
//if close must free pfile
//free(pFile);
#elif (USE_MODE==WINDOWS_MFC)
U32 t_wtmp;
CString m_strElement;
LPCSTR lpszPath = "D:\\My Documents\\桌面\\cmd.txt";
ReadFilePathName=lpszPath;
CFile fp;
if(!(fp.Open((LPCTSTR)ReadFilePathName,CFile::modeRead)))
{
MORRIS_TRACE("Open file failed!");
return;
}
fp.SeekToEnd();
U32 fplength=fp.GetLength();
U8* fpBuff;
fpBuff=new U8[fplength];
fp.SeekToBegin();
if(fp.Read(fpBuff,fplength)<1)
{
fp.Close();
return;
}
fp.Close();
MORRIS_TRACE(fpBuff);