alan
2003-11-07 07:25:20 UTC
Dear all,
I am a newbie in mfc.
I have a problem on throw CFileException object.
I wrote a function to open a test.txt file from C drive.
if the file is existed, it works fine. But I can to catch error if
file doesn't exist. I don't know the following fucntion doesn't work.
I read MSDN , CStdioFile class will throw error if file the file
cannot be opened or created.
Can any body help me? I am very appreciated if any help.
void readFile(CString file)
{
CString str;
vector<CString> v;
try
{
CStdioFile f1("C:\\test.txt", CFile::modeRead);
f1.Close();
}
catch(CFileException e)
{
e.m_cause;
}
}
regards,
alan
I am a newbie in mfc.
I have a problem on throw CFileException object.
I wrote a function to open a test.txt file from C drive.
if the file is existed, it works fine. But I can to catch error if
file doesn't exist. I don't know the following fucntion doesn't work.
I read MSDN , CStdioFile class will throw error if file the file
cannot be opened or created.
Can any body help me? I am very appreciated if any help.
void readFile(CString file)
{
CString str;
vector<CString> v;
try
{
CStdioFile f1("C:\\test.txt", CFile::modeRead);
f1.Close();
}
catch(CFileException e)
{
e.m_cause;
}
}
regards,
alan