Prepares for operations on the file corresponding to the filename of the first parameter. In the open routine, the file type (console, printer, disk file, etc.) must be determined in order to enable writing or reading at a later time. The file type must be referenced using the file number returned by the open routine each time reading or writing is to be performed. |
The second parameter mode specifies processing to be performed when the file is opened. The meanings of each of the bits of this parameter are as follows. |
When there is a contradiction between the file processing specified by mode and the properties of the actual file, error processing should be performed. When the file is opened normally, the file number (a positive integer) should be returned which should be used in subsequent read, write, lseek, and close routines. The correspondence between file numbers and the actual files must be managed by low-level interface routines. If the open operation fails, -1 should be returned. |
Normal: The file number for the successfully opened file
mode Specifies the type of processing when the file is opened
flg Specifies processing when the file is opened (always 0777)