Sign in Join
Wiki copytemporary

Rewrite: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Rewrite

OldNewLine
1+The [[Procedure|procedure]] [`rewrite`](https://www.freepascal.org/docs-html/rtl/system/rewrite.html) clears and opens a file for writing. If the file did not exist, it is created.
2+
3+## signature
4+
5+- `rewrite(var destination: text)`
6+- `rewrite(var destination: file of T)` where `T` is an acceptable record type
7+- `rewrite(var destination: file; recordsize: longInt = 128)` ([[FPC]] extension)
8+
9+## behavior
10+
11+After invoking `rewrite` it is guaranteed that
12+
13+- the destination file is completely undefined (i. e. empty),
14+- the writing cursor is at the beginning of the file, and
15+- the file is writable and non-readable.
16+
17+## see also
18+
19+- [[Reset|reset]]
20+
21+---
22+*From the Free Pascal wiki, page "Rewrite", as it stood on 2022-08-09 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
23+Category: File Handling
24+Category: Pascal

Back to history