Language:
Русский
English
Rewrite (procedure)
Creates and opens a new file.
Declaration
procedure Rewrite(var F: File [; Recsize: Word ] );
Target
Windows, Real, Protected
Remarks
F is a variable of any file type associated with an external file using Assign. RecSize is an optional expression of type Word, which can be specified only if F is an untyped file. If F is an untyped file, RecSize specifies the record size to be used in data transfers. If RecSize is omitted, a default record size of 128 bytes is assumed.
Rewrite creates a new external file with the name assigned to F. If an external file with the same name already exists, it is deleted and a new empty file is created in its place. If F is already open, it is first closed and then re-created. The current file position is set to the beginning of the empty file.
If F was assigned an empty name, such as Assign(F,''), then after the call to Rewrite, F refers to the standard output file (standard handle number 1).
If F is a text file, F becomes write-only. After a call to Rewrite, Eof(F) is always True.
With {$I-}, IOResult returns 0 if the operation was successful; otherwise, it returns a nonzero error code.