I have solve this problem to find whether the file is open or closed by using a variable of boolean type.
if(closed==false)
{
readFile.Close();
closed=true;
}
and before opening a file
if(closed==true)
{
if (readFile.Open(strFilePath, CFile::modeRead, &fileException))
{
closed=false;
{
}
}
}
when ever closed make true when ever opened make false