CStdioFile file;
if(!file.Open("G:\\ReadFromFile\\IP.txt", CFile::modeRead))
{
AfxMessageBox("can   not   open   file!");
return;
}
CString strLine,strEdit; while(file.ReadString(strLine))
{
              ............
          }
file.Close();

解决方案 »

  1.   

    用CStdioFile打开文件,每次调用ReadString读一行
      

  2.   

    LS说掉了 没办法了 纯JF。
      

  3.   

    又出现新问题了:在使用GETAT时提示出错,我不知道如何改,最好哪个好心人帮我改得详细点,我的题目要求是这样的:想把TXT文件中的每一行的第15个字符取出组成一个字符串.多谢了!
      

  4.   

    1. 打开文件2. 读行3. CString的getat4. 拼起来注意: 读行也好 字符也好 不要越界 确信读的位置有东西
      

  5.   

    前几天我也问了这个问题,你到我那看一下吧
    http://community.csdn.net/Expert/topic/5557/5557820.xml?temp=.1525843
      

  6.   

    # include <fstream.h>
    void main()
    {
    ifstream fin("D:\\txt",ios::in);
    while(fin.getchar())
    {
    fin.putback();
    char ch[1024];
    fin.getline(ch,strlen(ch));
    }
    }