I get the fact that the cause code value of 2 is for the file not found.
All I do is just read the file and open to see if its readable.
I am pasting below a piece of code.
I am not sure why should the open fail when we try to open just the file in the read only mode. The application is a multi threading environment. I have run out of ideas as the file does exist, i am tryong to open the gzip files. This does not happen always that the read of this fails.Code:BOOL bReadFile( BYTE* p, INT32& nSize, CString strFilename) { CFile cfSessionFile; CFileException ex; if (cfSessionFile.Open( strFilename, CFile::modeRead, &ex)) { nSize = (INT32) cfSessionFile.GetLength(); if((p != NULL) && (nSize > 0)) { cfSessionFile.Read( p, nSize); } cfSessionFile.Close(); } else { m_ologging.writelogmessage("failed to open the file with cause =%d",ex.m_cause); return FALSE; } return TRUE; }
I would be really happy if i could get any help on it.
Cheers,
Rajesh.



LinkBack URL
About LinkBacks


