Code:
#include <stdio.h>
#include <sys/stat.h>
int main(int argc, char *argv[])
{
struct stat buf;
if (stat(argv[0], &buf) != -1)
{
printf("File size = %d\n", buf.st_size);
printf("File mode = %03o\n", buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));
printf("File UID = %d\n", buf.st_uid);
printf("File GID = %d\n", buf.st_gid);
printf("File last accessed = %s", ctime(&buf.st_atime));
printf("File last modified = %s", ctime(&buf.st_mtime));
printf("File last changed = %s", ctime(&buf.st_ctime));
}
return (0);
}