open Function

Open a file.

Attention: This interface function is implemented only by MPLAB XC32 C compilers.




int open(const char *name, int access, int mode);


name of the file to be opened
access method to open file
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, and the global variable errno is set to the value of the symbolic constant, EFOPEN, defined in <errno.h>.


This function is implemented as a stub that must be completed to suite the application.

This helper function is called by the Standard C Library functions fopen() and freopen().

The access flag is a union of one of the following access methods and zero or more access qualifiers:
The following access qualifiers must be supported:
The mode parameter may be one of the following:

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.

Source File