Article ID: 181880 - Last Review: December 8, 2003 - Revision: 2.0 PRB: "Access to an Unnamed File Was Denied" ErrorThis article was previously published under Q181880 SYMPTOMS
You get the following error when calling CFile::Read():
Access to an unnamed file was denied.
CFile exception: accessDenied, File Unknown, OS error information = 5
CAUSE
You are actually opening the file without read access. The following
intuitively correct code causes the error:
RESOLUTION
Specify CFile::modeReadWrite instead of the logical OR of CFile::modeRead
and CFile::modeWrite.
STATUS
This behavior is by design.
REFERENCES
For more information about CFile, or other MFC classes, consult the
Microsoft Visual C++ online help.
APPLIES TO
| Article Translations
|

Back to the top
