#include<conio.h>
#include<iostream.h>
#include<afx.h>
int main()
{
CFile f;
CFileException e;
char* pFileName="d:\\test.dat";
if(!f.Open(pFileName,CFile::modeRead,&e))
{
cout<<("Open File Failed!")<<endl;
}
//*
else
{
char pbuff[100];
int nBytesRead=f.Read(pbuff,100);
for(int i=0;i<nBytesRead;i++)
{
cout<<pbuff[i];
}
cout<<"Press any key to exit!\n";
}
//*/
/*
else
{
char pbuff[100];
int nBytesRead=f.Read(pbuff,100);
for (int i=0;i<nBytesRead;i++)
{
cout<<pbuff[i];
}
cout<<"Press any key to exit!"<<endl;
}
//*/
getch();
f.Close();
return 0;
}