Serais-tu me dire pourquoi, je n'arrive pas à ouvrir mon fichier?
Voici mon code:
void CMyEditApp::onFichierOuvrir()
{
CString OpenFilter;
OpenFilter = "Text File (*.txt)|*.txt||";
CFileDialog FileOpenDialog(
TRUE,
NULL,
NULL,
OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST,
OpenFilter,
// filter
AfxGetMainWnd());
// the parent window
if(FileOpenDialog.DoModal()==IDOK)
{
CFile File;
VERIFY(File.Open(FileOpenDialog.GetPathName(),CFile::modeRead));
CString pszFileName = FileOpenDialog.GetPathName();
const char* pStr = (LPCTSTR) pszFileName;
CFile myFile;
CFileException fileException;
try {
CFile file (_T (pStr), CFile::modeReadWrite);
}
catch (CFileException* e) {
// Something went wrong.
e->ReportError ();
e->Delete ();
}
}}
Voici l'erreur:
First-chance exception in MyEdit.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
Reporting file I/O exception on Save/Load with lOsError = $20.
CDocument::OnOpenDocument returned FALSE.
|