Linux服务器编程之:utime()函数
1.依赖的头文件
#include<sys/types.h>
#include<utime.h>
2函数声明
int utime(const char *filename, const struct utimbuf *times);
#include<sys/time.h>
int utimes(const char *filename,const struct timeval times[2]);
函数说明:
The utime() system call changes the access and modification times of
the inode specified by filename to the actime and modtime fields of
times respectively.
翻译:调用utime来修改inode中的信息,传递的值有:文件名,访问时间和更改时间。
If times is NULL, then the access and modification times of the file
are set to the current time.
翻译:如果时间为NULL,访问时间和修改时间默认设置成了当前时间。
成功放回0,失败返回1
3.下面是 utimbuf这个结构体:
struct utimbuf
{
time_t atime; /*access time :访问时间*/
time_t modtime; /*modification time : 更改时间*/
};
4.utimes()调用也
The utimes() system call is similar, but the times argument refers to
an array rather than a structure. The elements of this array are
timeval structures, which allow a precision of 1 microsecond for speci‐
fying timestamps. The timeval structure is:
struct timeval {
long tv_sec; /* seconds */
long tv_usec; /* microseconds */
};
times[0] specifies the new access time, and times[1] specifies the new
modification time. If times is NULL, then analogously to utime(), the
access and modification times of the file are set to the current time.
utimes()的调用也相似,但是这个时间指定的是一个数组,而不是一个结构体,数组的每个元素师一个timeval结构体
这个结构体中允许一个为timestamps所用的精确的微秒值(微秒,百万分之一秒),其中timeval结构体如下:
struct timeval
{
long tv_sec; /*seconds 秒*/
long tv_usec; /*microseconds 微秒,百万分之一秒*/
}
times[0]这个元素指定的是访问时间,times[1]指定的是修改时间。如果时间为NULL,那么,类似(analogously)utime(),
访问时间和修改时间被设置成当前时间。
Linux服务器编程之:utime()函数相关推荐
- linux读取文件修改时间函数,Linux服务器编程之utime()函数修改文件存取时间
Linux服务器编程之utime()函数修改文件存取时间 C语言utime()函数:修改文件的存取时间和更改时间 头文件: #include #include 定义函数: int utime(cons ...
- linux网络编程之Listen函数参数介绍
1.listen()函数介绍 listen函数使用主动连接套接口变为被连接套接口,使得一个进程可以接受其它进程的请求,从而成为一个服务器进程.在TCP服务器编程中listen函数把进程变为一个服务器, ...
- Linux服务器编程之:link()函数,ln命令,symlink,readlink,案例说明
1 link()依赖头文件 #include<unistd.h> 2函数定义 int link(const char *oldpath,const char *newpath); 函数说明 ...
- Linux服务器编程之:truncate()函数+案例说明
1.依赖头文件 #include<unistd.h> #include<sys/types.h> 2.函数定义: int truncate(const char *path,o ...
- Linux服务器编程之:chown()函数,chown命令
1.依赖的头文件 #include<unistd.h> 2.函数定义: //通过传入path的方式,改变和文件的拥有关系,如果他是一个符号链接,则跟踪它 int chown(const c ...
- linux chown 函数用噶,Linux服务器编程之:chown()函数,chown命令
1.依赖的头文件 #include 2.函数定义: //通过传入path的方式,改变和文件的拥有关系,如果他是一个符号链接,则跟踪它 int chown(const char *path, uid_t ...
- linux ioctl网络参数设置,Linux 网络编程之ioctl函数
1.介绍 Linux网络程序与内核交互的方法是通过ioctl来实现的,ioctl与网络协议栈进行交互,可得到网络接口的信息,网卡设备的映射属性和配置网络接口.并且还能够查看,修改,删除ARP高速缓存的 ...
- Linux 应用编程之stat 函数
Linux 下可以使用 stat 命令查看文件的属性,其实这个命令内部就是通过调用 stat()函数来获取文件属性的,stat 函数是 Linux 中的系统调用,用于获取文件相关的信息.(可通过&qu ...
- Linux应用编程之dup函数和dup2函数
在 Linux 系统中,open 返回得到的文件描述符 fd 可以进行复制,复制成功之后可以得到一个新文件描述符,使用新的文件描述符和旧的文件描述符都可以对文件进行 IO 操作,复制得到的文件描述符和 ...
最新文章
- 博客 | Machine Learning Yearning 要点笔记
- SAP PR 转 PO
- sql已经完成,生成表
- Project Euler Problem 9-Special Pythagorean triplet
- docker学习笔记(一)docker入门
- python 判断时间是否大于6点_python - 在dataframe中,如何检查时间增量是否大于一分钟?_pandas_酷徒编程知识库...
- GetCommandLineW()作用
- 获取小程序 openid
- Goodfellow“死磕”NIPS:这名字涉及色情和仇日
- 调整jvm参数_JVM源码分析之MetaspaceSize和MaxMetaspaceSize的区别
- 手机android系统安装,如何重新安装Android手机系统
- 电大本科计算机科学与技术,中央电大开放本科计算机科学与技术专业微计算机技术试题_0701...
- 最新电脑cpu性能排行服务器,服务器cpu性能排行,教您服务器cpu性能排行
- 美团点评数据平台融合实践
- ESP8266 下 OTA 更新 Firmware 和FileSystem
- Matlab代码区出现中文乱码的情况
- Ae试水~(待填坑)
- 绿色版Mysql的安装配置
- PCB之AD快速布局
- 分享优质JAVA学习网站
热门文章
- wxWidgets:编写一个应用程序- 使用 WxTextCtrl
- wxWidgets:wxTextCompleterSimple类用法
- wxWidgets:wxSpinCtrl类用法
- wxWidgets:wxSearchCtrl类用法
- boost::hana::hash用法的测试程序
- boost::hana::drop_front用法的测试程序
- bgi::detail::intersection_content用法的测试程序
- boost::dynamic_bitset模块的测试程序
- boost的chrono模块线程时钟的测试程序
- Boost:双图bimap与property地图的测试程序