在delphi中使用哪些类可以方便的读写.txt文件?
最好有范例,谢谢!

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/3301/3301930.xml?temp=.3837549
      

  2.   

    var   F: TextFile;
      S: string;
    begin
      if OpenDialog1.Execute then            { Display Open dialog box }
      begin
        AssignFile(F, OpenDialog1.FileName); { File selected in dialog }
        Reset(F);
        Readln(F, S);                        { Read first line of file }
        Edit1.Text := S;                     { Put string in a TEdit control }
        CloseFile(F);
      end;
    end;
      

  3.   

    定义一个TextFile类型的变量,然后通过OpenDialog获得文件名(txt扩展名),然后AssignedFile将文件和F关联通过Reset等等过程进行操作。