I have the following code:
struct stat info;
stat("/Users/john/test.txt", &info);
printf("%s\n", ctime(&info.st_mtimespec));
in which I am trying to get the last modified time of the file as displayed in the ls -l
command in the format:
Jan 29 19:39
Unfortunately, above code doesn't work.I get the following error message on xcode:
Conflicting types for ctime
How can I fix it ? If there any alternative approaches to get the time in format mentioned, please do mention.