我读文件的时候,怎样判断它结束呢,难道非要知道文件的大小才可以嘛!
c语言中有一个
while(fgetc(..)!=eof!)
{
读文件
}
那vc中怎么实现呢

解决方案 »

  1.   

    CFile::Read 
    virtual UINT Read( void* lpBuf, UINT nCount );
    throw( CFileException );Return ValueThe number of bytes transferred to the buffer. Note that for all CFile classes, the return value may be less than nCount if the end of file was reached. 
      

  2.   

    如果用
    ifstream in;
    判断是否结束用
    in.eof();
      

  3.   

    bSuccess = ReadFile();再正好读到文件末尾时,返回值为TRUE, 但是读取的字节数为0,比如: if (bSuccess && 0 == dwReaded)
     {  //// 读取完了场合
        break;
      }