Problema s CFile
Ya napisal :
CFile fl;
try{
fl.Open("nfile.txt",CFile::modeRead|CFile::typeBinary);
}
catch(CFileException er)
{
return false;
}
No pri vvode nepravilnogo imeni fayla isklucheniye ne vizivayetsya i programu prosto vibivayet
Moget ya chegoto ne ponimayu v isklucheniyah ?
Код:
virtual BOOL Open( LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL );
Надо так:
Код:
CFile fl;
CFileException ex;
if( !fl.Open( "nfile.txt", CFile::modeRead | CFile::typeBinary, &ex ) )
{
//ошибка открытия
char szErrorMessage[256];
ex.GetErrorMessage( szErrorMessage, 256 );
}
CFileException ex;
if( !fl.Open( "nfile.txt", CFile::modeRead | CFile::typeBinary, &ex ) )
{
//ошибка открытия
char szErrorMessage[256];
ex.GetErrorMessage( szErrorMessage, 256 );
}