[C] 取文件日期和时间 →→→→→进入此内容的聊天室

来自 , 2019-07-13, 写在 C, 查看 137 次.
URL http://www.code666.cn/view/ce6c9230
  1. #include <stdio.h>
  2. #include <io.h>
  3.  
  4. int main(void)
  5. {
  6.    FILE *stream;
  7.    struct ftime ft;
  8.  
  9.    if ((stream = fopen("TEST.$$$",
  10.         "wt")) == NULL)
  11.    {
  12.       fprintf(stderr,
  13.              "Cannot open output file.\n");
  14.       return 1;
  15.    }
  16.    getftime(fileno(stream), &ft);
  17.    printf("File time: %u:%u:%u\n",
  18.           ft.ft_hour, ft.ft_min,
  19.           ft.ft_tsec * 2);
  20.    printf("File date: %u/%u/%u\n",
  21.    ft.ft_month, ft.ft_day,
  22.    ft.ft_year+1980);
  23.    fclose(stream);
  24.    return 0;
  25. }
  26.  

回复 "取文件日期和时间"

这儿你可以回复上面这条便签

captcha