in C i am using this code to get the c time or a time or m time
struct dirent *dir;
struct stat my;
stat(what, &my);
thetime = my.st_ctime;
How can i check if i have permission to check the c time of the file?
in C i am using this code to get the c time or a time or m time
struct dirent *dir;
struct stat my;
stat(what, &my);
thetime = my.st_ctime;
How can i check if i have permission to check the c time of the file?
stat returns -1 on error.
if(stat(what, &my) == -1)
{
perror("Cannot stat file");
exit(1);
}
OR before doing anything with a file call access() which is specifically meant to check permissions + access to file