The assign procedure


The assign procedure names a file variable. NOTE: You can't use this function to rename a file, use the built-in procedure rename if you want to do that.


  1. The first parameter is a reference to the file variable to be named.
  2. The second parameter is an expression of string type or char type, and is the new name of the file variable.
The name of a file variable controls which file is opened when the file variable is opened. 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.


For example to open a file named 'README.TXT' for reading you could use.

    assign(f, 'README.TXT');

where f is a reference to a file variable.


Operating Systems: All
Standard Pascal: No