/* 标准I/O  文件I/O  */
1
#include <dirent.h> 2 #include <stdio.h> 3 #include <sys/stat.h> 4 #include <time.h> 5 6 int main() 7 { 8 DIR *dir; 9 struct dirent *dent; 10 struct stat buf; 11 dir = opendir("."); 12 if(dir) 13 { 14 while((dent = readdir(dir))!=NULL) 15 { 16 stat(dent->d_name,&buf); 17 struct tm *t=localtime(&buf.st_ctime); 18 printf("create time:%04d-%02d-%02d %02d:%02d:%02d ",t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec); 19 printf("name:%-16s size:%d\n",dent->d_name,(int)buf.st_size); 20 } 21 } 22 23 }

相关文章:

  • 2021-09-11
  • 2021-10-17
  • 2021-05-27
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2021-11-13
  • 2022-12-23
  • 2021-07-01
相关资源
相似解决方案