A file opened with O_APPEND causes the current file offset to be initialized to the number of bytes from the beginning of the file. Normally, when a file is opened, the current offset is initialized to zero. Reading and writing normally start at the current file offset and the offset is incremented by the number of bytes read or written. A file opened with O_TRUNC causes the contents of the file to be deleted when it is opened. A file opened with O_CREAT is created if it does not exist in the file system at the time it is opened.
The OpenMode property can be specified in both a component instantiation and a component definition. The set of values for any OpenMode properties in a SeqFile component definition are merged with the values in the OpenMode properties in instantiations of the component. This merged set is then used as the set of open mode options for the file when it is opened in the system during execution.
There is no default value for the OpenMode property. If the property is not specified, none of the three open mode options are supplied as parameters during the open.
More than one specification of the OpenMode property in a single property list is treated as a single specification with the union of all values in all of the specifications.
COMPONENT Data_File INTERFACE IS TYPE SeqFile OPENMODE (create) RECORDFORMAT ("line") PLAYER Next_Line IS ReadNext END INTERFACE IMPLEMENTATION IS VARIANT Data_File IN "datafile" IMPLTYPE (Data) END Data_File END IMPLEMENTATION END Data_FileBelow is another example of a specification of an OpenMode property. It is embedded in an instantiation of the above SeqFile component:
USES My_Data_File INTERFACE Data_File OPENMODE (truncate) END My_Data_FileThe OpenMode value for the My_Data_File SeqFile instantiation is create and truncate.
Author:
Last Modified: May 12, 1996