GEOS SDK TechDocs
|
|
3.8 Updating and Saving Files
|
3.10 The VM File's Map Block
VMClose()
When you are done with a VM file for the time being, you should close it with
VMClose()
. This routine updates all the dirty blocks, frees all the global memory blocks attached to the file, and closes the file (thus freeing its handle). The routine is passed two arguments. The first is the handle of the file to close. The second is a flag,
noErrorFlag
. If this flag is FILE_NO_ERROR,
VMClose()
will not return error conditions; if it could not successfully close the file, it will fatal-error.
If
noErrorFlag
is
false
(i.e., zero),
VMClose()
will update the file and close it. If the file could not be updated, it will return an error condition. Be warned, however, that if for some reason
VMClose()
could not finish updating a file (for example, because the disk ran out of space),
VMClose()
will return an error message, but will close the file and free the memory anyway. Thus, the most recent changes will be lost. For this reason, it is usually safer to first update the file (and handle any error messages returned) and then close it.
When GEOS shuts down, all files are closed. When it restarts, you can open the files manually.
If the file is backup-enabled, the backup blocks will be preserved until the file is next opened. That means, for example, that the next time you open the file, you can continue working on it normally, or you can immediately revert it to its condition as of the last time it was saved (in the earlier GEOS session).
GEOS SDK TechDocs
|
|
3.8 Updating and Saving Files
|
3.10 The VM File's Map Block