From Lazarus wiki
Jump to navigationJump to search

The procedure rewrite clears and opens a file for writing. If the file did not exist, it is created.


  • rewrite(var destination: text)
  • rewrite(var destination: file of T) where T is an acceptable record type
  • rewrite(var destination: file; recordsize: longInt = 128) (FPC extension)


After invoking rewrite it is guaranteed that

  • the destination file is completely undefined (i. e. empty),
  • the writing cursor is at the beginning of the file, and
  • the file is writable and non-readable.

see also