Guardian Programmer's Guide

Table Of Contents
Using the IOEdit Procedures
Guardian Programmer’s Guide 421922-014
14 - 19
Closing an IOEdit File
Closing an IOEdit File
This subsection discusses how to use the CLOSEEDIT_ and CLOSEALLEDIT
procedures. In addition to closing EDIT files, these procedures also cause the IOEdit
buffers in the EFS to be copied to disk.
Closing a Single File
You usually close EDIT files one at a time using the CLOSEEDIT_ procedure. You
supply the procedure with the file number; for example:
ERROR := CLOSEEDIT_(FILE^NUM);
IF ERROR > 0 THEN ...
IOEdit responds by closing the file and copying the buffers to disk.
Closing All EDIT Files
You can close all EDIT files that your process has open by issuing a call to the
CLOSEALLEDIT procedure. You might do this, for example, in a signal handler or trap
handler to save the file buffers before stopping the process. For example:
CALL CLOSEALLEDIT;
See Section 25, Debugging, Trap Handling, and Signal Handling, for a discussion of
trap handlers.
Caution. You must close EDIT files explicitly. If you allow EDIT files to be closed implicitly by
stopping the process, then you will lose the contents of the IOEdit buffers.