首先贴上MSDN上的解释:
-
CFileException::none No error occurred.
-
CFileException::genericException An unspecified error occurred.
-
CFileException::fileNotFound The file could not be located.
-
CFileException::badPath All or part of the path is invalid.
-
CFileException::tooManyOpenFiles The permitted number of open files was exceeded.
-
CFileException::accessDenied The file could not be accessed.
-
CFileException::invalidFile There was an attempt to use an invalid file handle.
-
CFileException::removeCurrentDir The current working directory cannot be removed.
-
CFileException::directoryFull There are no more directory entries.
-
CFileException::badSeek There was an error trying to set the file pointer.
-
CFileException::hardIO There was a hardware error.
-
CFileException::sharingViolation SHARE.EXE was not loaded, or a shared region was locked.
-
CFileException::lockViolation There was an attempt to lock a region that was already locked.
-
CFileException::diskFull The disk is full.
-
CFileException::endOfFile The end of file was reached.
第11个是:CFileException::hardIO There was a hardware error. 没错 就是这个。
然后看到有个网友推测原因:
hz129(古雨)
是不是你生成文件的句柄还没释放,所以该文件被锁为只读或根本不能读写了? 我也没遇到过,只是我的猜想 |
果断正确,我有两个项目,一个项目调试中,输出文件; 启动另一个项目读取文件····· 就这么回事儿,退出前一个项目即可顺利读取,Close();
是不是你生成文件的句柄还没释放,所以该文件被锁为只读或根本不能读写了?
我也没遇到过,只是我的猜想 |