| Target Language Compiler | ![]() |
Output File Control
The structure of the output file control construct is
%openfile
The %openfile directive opens a file or buffer for writing; the required string variable becomes a variable of type file. For example,
%openfile x /% Opens and selects x for writing. %/ %openfile out ="out.h"/% Opens"out.h"for writing. %/
%selectfile
The %selectfile directive selects the file specified by the variable as the current output stream. All output goes to that file until another file is selected using %selectfile. For example,
%closefile
The %closefile directive closes the specified file or buffer, and if this file is the currently selected stream, %closefile invokes %selectfile to reselect the last previously selected output stream.
There are two possible cases that %closefile must handle:
%undef.
If desired, you can append to an output file or string by using the optional mode, a, as in
| Object-Oriented Facility for Generating Target Code | Input File Control | ![]() |