access() function call does not work
I am supposed to verify a file accesibilty, whether it is readable, or writable..so i used access() system call. It is not working...
Here is my check...
#define FILE "./file.txt"
//I am changing the permission as r only
chmod (FILE, S_IRUSR | S_IRGRP | S_IRGRP)
//I am checking here if it is read, or write able
if(access(FILE, W_OK) == 0)
{
//file is wrioteable
} else if(access(FILE, R_OK) == 0)
{
//file is readable
}
I was expecting file is readable only...how come it is writeable ?
Any idea ??
|