如题

解决方案 »

  1.   

    直接用 stringlist.savetofile 就可达到你的要求!!
      

  2.   

    if FileExists('路径'+文件名) then 
         application.messagebox('文件存在','提示',mb_ok)
      else 
         application.messagebox('文件不存在','提示',mb_ok)
      

  3.   

    var
      f: TStringList;
    begin
      f := TStringList.Create;
      f.savetofile(ExtractFilePath(Application.ExeName) + 'temp\abc.txt');
      f.free;
    end;
      

  4.   

    不懂用TStringList干嘛 这样不可以吗
    if not FileExists(FileName) then FileCreate(FileName);
      

  5.   

    procedure TForm1.stlistClick(Sender: TObject);
    var
    stringlist:tstringlist;
    begin
    stringlist:= TStringList.Create;
    if not FileExists ('a.txt') then
      stringlist.SaveToFile('a.txt');
    stringlist.loadfromfile('a.txt');
    stringlist.add(st.text)   ;
    stringlist.savetofile('a.txt');
    stringlist.Free;
    end;