不信吗 你可以试一下
生成一个9450 行的文本文件 每一行都是一个字符 "0"
然后你在用ReadString 读一行 你就知道了

解决方案 »

  1.   

    CStdioFile类要它有什么用啊 以后读写用 C++ 的库吧
      

  2.   

    谁说的!我生成了 108,882个字节的文件都没问题,何况是36K!
    问题肯定在你自己身上!
    // wstr.cpp : Defines the entry point for the console application.
    //#include "stdafx.h"
    #include "wstr.h"#ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    #endif/////////////////////////////////////////////////////////////////////////////
    // The one and only application objectCWinApp theApp;using namespace std;int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
    {
    int nRetCode = 0; // initialize MFC and print and error on failure
    if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
    {
    // TODO: change error code to suit your needs
    cerr << _T("Fatal Error: MFC initialization failed") << endl;
    nRetCode = 1;
    }
    else
    {
    // TODO: code your application's behavior here.
    CString strHello;
    strHello.LoadString(IDS_HELLO);
    cout << (LPCTSTR)strHello << endl;
    } CStdioFile f("ttt.txt" , CFile::modeCreate | CFile::modeWrite);
    CString s;
    for(int i=1 ; i< 10000; i++)
    {
    s.Format("Line %d\n" , i);
    f.WriteString(s);
    }
    f.Close(); return nRetCode;
    }
      

  3.   

       CStdioFile sfile;
      
       CString csTemp;
       
       if((_access("coexpert.txt", 0)) == -1)
       {
       sfile.Open("coexpert.txt", CFile::modeWrite|CFile::modeCreate);
       for(int t = 0; t < 5*18*7*5*3; t ++)
       csTemp +="0\r\n";
       sfile.WriteString(csTemp);
       sfile.Close();
       }
       
       
       
       sfile.Open("coexpert.txt", CFile::modeRead);
      
       for(int i = 0; i < 5; i++)
       {
       for(int j = 0; j < 18; j++)
       {  
       for(int k = 0; k < 7; k++)
       { 
       for(int m = 0; m < 5; m++)
       {
       sfile.ReadString(csTemp);
       assert(csTemp == "0\r");// 注意这里 如果 cs == "0" 将出错
       m_room[i].day[j][k].time[m].already = atoi((LPCTSTR)csTemp);
       
       sfile.ReadString(csTemp);
       
       strcpy(m_room[i].day[j][k].time[m].name, csTemp);
       sfile.ReadString(csTemp);
       strcpy(m_room[i].day[j][k].time[m].telephone, csTemp);
       }
       }
       }
       } 
       sfile.Close();