码迷,mamicode.com
首页 > 其他好文 > 详细

utime修改文件的存取,修改时间

时间:2017-01-20 19:10:00      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:cat   int   span   需要   file   types.h   pes   name   nbsp   

#include <sys/types.h>
#include <utime.h>

int utime(const char *filename, const struct utimbuf *times);

#include <sys/time.h>

int utimes(const char *filename, const struct timeval times[2]);

 

struct utimbuf {
time_t actime; /* access time */
time_t modtime; /* modification time */
};

把文件的存取时间设置为times的actime

把文件的修改时间设置为times的modtime

 

如果times是个空指针将 “存取时间”  和 “修改时间” 设置为当前时间。

NULL需要头文件#include <unistd.h>

 

utime修改文件的存取,修改时间

标签:cat   int   span   需要   file   types.h   pes   name   nbsp   

原文地址:http://www.cnblogs.com/zhangxuan/p/6323374.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!