access Function

Determine accessibility of a file

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




int access(const char * filename, int how);


name of the file to be accessed
type of access permitted

Return Value

The return value is 0 if the access is permitted, and -1 otherwise. For the value -1, errno is set to indicate the kind of error. Appropriate values may be EACCES, ENOENT or EROFS, among others.


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

The access function checks to see whether the file named by filename can be accessed in the way specified by the how argument. The argument either can be the bitwise OR of the flags R_OK, W_OK, X_OK, or the existence test F_OK

This function uses the real user and group IDs of the calling process, rather than the effective IDs, to check for access permission. As a result, if you use the function from a setuid or setgid program, it gives information relative to the user who actually ran the program.

Source File