file is the file name to open, relative to the current share or with the full URL specified.
flags is a logical 'or' combination of flags. Valid flags are
:
O_RDONLY : Opens the file read-only.
O_WRONLY : Opens the file write-only.
O_RDWR : Opens for reading and writing.
O_CREAT : If the file doesn't exist, it will be
created.
O_TRUNC : If the file already exists, it is truncated.
O_EXCL : Useful together with O_CREAT only. If the
file did already exist, an error is returned.
O_APPEND : The file position pointer is placed atr
the end of the file.
Other flags are ignored.
mode should specify the permissions of the file if a new file is created. The flag isn't used at present, and anyway since Unix permissions must be mapped to DOS attributes, this parameter isn't very relevant.
This method returns a file descriptor, which can be used only for this
library functions. Do not use standard functions with these descriptors.
On error, -1 is returned and error() will return the corresponding
error code.
Close the file associated with this file descriptor
int close(int
fd)