写入文件

procedure TForm1.Button1Click(Sender: TObject);
var   F:TextFile;
      fName: string;
begin
    fName := 'error.txt';
    AssignFile(F,fName);

     if FileExists(fName)   then Append(F)   else Rewrite(F);

    Writeln(F, 'this is string');
    CloseFile(F);
end;





你可能感兴趣的:(文件)