Open a file.
Include
None
Prototype
int open(const char *name, int access, int
mode);
Arguments
name |
name of the file to be opened |
access |
access method to open file |
mode |
type of access permitted |
Return Value
If successful, the function returns a file handle: a small positive integer. This handle is then used on subsequent low-level file I/O operations. A return value of ‘-1’ indicates an error.
Remarks
This helper function is called by the Standard C Library functions
fopen()
and freopen()
.
Default Behavior
As distributed, the parameters are passed to the host file system through the simulator.
The return value is the value returned by the host file system. If the host system
returns a value of ‘-1’, the global variable errno
is set to the value
of the symbolic constant, EFOPEN
, defined in
<errno.h>
.
File
open.c