#include <unistd.h>
|
#include <wchar.h>
|
int
waccess (const wchar_t *path, int mode); |
For additional information, see the File access Permission section of intro . X_OK, the file may not actually have execute permission bits set. Likewise for R_OK and W_OK.
Note that as execute-bit for file is not supported .Hence waccess system call for X_OK is undefined.
/** * Detailed description: This sample code checks read-ok accessibility of file Example.c * * Precondtions: Example.txt file should be present in working directory. **/ #include <unistd.h> #include <wchar.h> int main() { if(waccess("Example.c" ,R_OK) < 0) { printf("Read operation on the file is not permitted \n") ; return -1 ; } printf("Read operation permitted on Example.c file \n") ; return 0 ; }
Output
Read operation permitted on Example.c file
[ENOTDIR] | |
A component of the path prefix is not a directory. | |
[ENAMETOOLONG] | |
A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters . | |
[ENOENT] | |
The named file does not exist. | |
[EACCES] | |
Permission bits of the file mode do not permit the requested access, or search permission is denied on a component of the path prefix. | |
© 2005-2007 Nokia |