Rewrite procedure
Prototype: |
procedure Rewrite(f: integer); |
|
Description: |
The Rewrite procedure empties the specified file and opens it for writing. |
|
Syntax: |
Rewrite(f); |
|
Part |
Description |
|
f |
The identifier of the file as returned by the AssignFile function |
|
Return value: |
none |
|
Example:
var
fileID: integer;
fileName: string;
begin
fileName:= 'listOfTrees.txt';
fileID:= AssignFile(fileName);
Rewrite(fileID); // this line deletes contain the file (in this case listOfTrees.txt)
WriteLn(fileID, 'picea, malus'); // this line writes a new values in the file
CloseFile(fileID);
end.
Output:
the text file before call the example
![]()
the text file after call the example
old data is overwritten
![]()
NOTE: the text file (listOfTrees.txt) is stored in the directory Field-Map, see below screenshot.

See also:
AssignFile; Reset; Rewrite; Append; WriteLn; ReadLn; EOF; CloseFile; DeleteFile; SaveStringToFile; SaveStringToFileAsUTF8
© 2024 IFER-Monitoring and Mapping Solutions