[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'System' (#rtl)

Rename

Rename file on disk

Declaration

Source position: line 0

procedure Rename(

  var f: file;

  const s: String

);

procedure Rename(

  var f: file;

  p: PChar

);

procedure Rename(

  var f: file;

  c: Char

);

procedure Rename(

  var t: Text;

  const s: String

);

procedure Rename(

  var t: Text;

  p: PChar

);

procedure Rename(

  var t: Text;

  c: Char

);

Description

Rename changes the name of the assigned file F to S. F must be assigned, but not opened.

Errors

Depending on the state of the {$I} switch, a runtime error can be generated if there is an error. In the {$I-} state, use IOResult to check for errors.

See also

Erase

  

Delete a file from disk

Example

Program Example77;

{ Program to demonstrate the Rename function. }
Var F : Text;

begin
  Assign (F,paramstr(1));
  Rename (F,paramstr(2));
end.
The latest version of this document can be found at lazarus-ccr.sourceforge.net.