LogFile.Open(m_strFilePathName,CFile::modeRead|CFile::modeNoTruncate);
//这里结构体大小为100
nRecordCount = LogFile.GetLength() // sizeof(RECORD_ENTRY);//算出来是5
for(int i=0; i<nRecordCount; ++i)
{
   UINT nByteReaded = LogFile.Read(chTemp,101);//进入循环体,执行完此句就会把nRecordCount修改为10???哪里出毛病了?

解决方案 »

  1.   

    没错,具体你可以去看MSDN,Read返回的就是你读到的字节数。
      

  2.   

    我知道Read返回的是读取到的字节数,关键是它会把nRecordCount修改掉,这是为什么?
      

  3.   

    nRecordCount是文件长度
    nRecordCount = LogFile.GetLength();这个作完就没有修改过!
      

  4.   

    要的是之前的代码,比如chTemp是如何声明的,nByteReaded 返回多大
    如果你的chTemp使用数组声明的话,那么你把数组的空间搞到256
    否则的话,你把她用数组声明