CreateFile打开一个文件
HANDLE hDev;
hDev = CreatFile("g:/001.txt", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0 , NULL);
if(hDev == NULL ¦ ¦ hDev == INVALID_HANDLE_VALUE)
{
return FALSE;
}
cFile file;
CFileException pError;
BOOL bFlg = file.Open("g:/002.txt", CFile::modeRead,&pError); //这步的时候出错了,打不开文件啊。超级郁闷。错误号是5,拒绝访问,各位大侠救命
if(!bFlg ¦ ¦ pError != 0)
{
return FALSE;
}
file.Read(...);
file.Close();