SystemRewrite (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

Rewrite example

Code

procedure TForm1.Button1Click(Sender: TObject);
var F: TextFile;
begin
  AssignFile(F, 'NEWFILE.$$$');
  Rewrite(F);  // default record size is 128 bytes
  Writeln(F, 'Just created file with this text in it...');
  CloseFile(F);
  MessageDlg('NEWFILE.$$$ has been created in the ' + GetCurrentDir + ' directory.',
    mtInformation, [mbOk], 0, mbOK);
end;

Uses