
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>access</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
access
======
Syntax
------
#include <unistd.h>
int access(const char *filename, int flags);
Description
-----------
This function determines what kind of access modes a given file allows.
The parameter FLAGS is the logical `or' of one or more of the following
flags:
`R_OK'
Request if the file is readable. Since all files are readable
under MS-DOS, this access mode always exists.
`W_OK'
Request if the file is writable.
`X_OK'
Request if the file is executable.
`F_OK'
Request if the file exists.
`D_OK'
Request if the file is really a directory.
Return Value
------------
Zero if the requested access mode is allowed, nonzero if not.
Example
-------
if (access("file.ext", W_OK))
return ERROR_CANNOT_WRITE;
open("file.ext", O_RDWR);
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson