The rewrite procedure


The rewrite procedure associates a file variable with a file (i.e. opens the file variable and allows it to be used to manipulate the file). The rewrite procedure opens the file variable in write-only mode. The open procedure can also be used to open file variables in write-only mode.


  1. The first parameter is a reference to the file variable to open.
  2. The second parameter is an expression of string type or char type, and names the file variable, referenced by the first parameter, as if the built-in procedure assign had been called. NOTE: This parameter is an extension to Standard Pascal.
The name of the file variable, referenced by the first parmater, controls which file is opened by the rewrite procedure. If the name is a non-empty string then a file with that name is opened. If the name is an empty string then the file opened is either the standard output file, or a temporary file (with a system generated name), depending on the project options set when the program was compiled.

File variables can get named in the following ways:


Operating Systems: All
Standard Pascal: Yes