E57 Foundation API v1.1.312  Aug. 10, 2011
void close ( )

Complete any write operations on an ImageFile, and close the file on the disk.

Completes the writing of the state of the ImageFile to the disk. Some API implementations may store significant portions of the state of the ImageFile in memory. This state is moved into the disk file before it is closed. Any errors in finishing the writing are reported by throwing an exception. If an exception is thrown, depending on the error code, the ImageFile may enter the closed state. If no exception is thrown, then the file on disk will be an accurate representation of the ImageFile.

Warning: if the ImageFile::close function is not called, and the ImageFile destructor is invoked with the ImageFile in the open state, the associated disk file will be deleted and the ImageFile will not be saved to the disk (the same outcome as calling ImageFile::cancel). The reason for this is that any error conditions can't be reported from a destructor, so the user can't be assured that the destruction/close completed successfully. It is strongly recommended that this close function be called before the ImageFile is destroyed.

It is not an error if ImageFile is already closed.

Postcondition:
ImageFile is in closed state.
Exceptions:
E57_ERROR_LSEEK_FAILED
E57_ERROR_READ_FAILED
E57_ERROR_WRITE_FAILED
E57_ERROR_CLOSE_FAILED
E57_ERROR_BAD_CHECKSUM
E57_ERROR_INTERNALAll objects in undocumented state
See also:
HelloWorld.cpp example, ImageFile::cancel, ImageFile::isOpen
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines