#include
#include
#include
int main(int argc, char *argv[])
{
struct stat sb;
stat(argv[1], &sb);
printf(File type:);
switch (sb.st_mode & S_IFMT) {
case S_IFDIR:printf(directory
);break;
case S_IFREG:printf(regular file
); break;
default: printf(other
);break;
}
printf(Mode: %lo (octal)
,
(unsigned long) sb.st_mode);
printf(File size:%lld bytes
,
(long long) sb.st_size);
printf(Last file access: %s,
ctime(&sb.st_atime));
return 0;
}
Reviews
There are no reviews yet.