#include
#include
#include
#include
int main()
{
char dir_str[256];
struct stat buf;
printf("Please input dir pathname\n");
scanf("%s", dir_str);
if (stat(dir_str, &buf)) {
switch (errno) {
case ENOENT:
printf("File \"%s\" not found\n", dir_str);
break;
case EINVAL:
printf("Invalid para to stat\n");
break;
default:
printf("Unexpected error!");
break;
}
} else {
printf("File size : %d\n", buf.st_size);
printf("File create time: %s\n", ctime(&buf.st_ctime));
}
return 0;
}
阅读(983) | 评论(0) | 转发(0) |