标签:
提供一个全平台修改文件的时间的方法,希望大家喜欢
/* UTIME.C: This program uses _utime to set the
* file-modification time to the current time.
* utime.c is a file you should change it by yourself
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef WIN32
#include <sys/utime.h>
#define SHOWCMD "dir utime.c"
#else
#define _utime utime
#define _utimbuf utimbuf
#include <utime.h>
#define SHOWCMD "ls -l utime.c"
#endif
void main( void )
{
/* Show file time before and after. */
system( SHOWCMD );
if( _utime( "utime.c", NULL ) == -1 )
perror( "_utime failed\n" );
else
printf( "File time modified\n" );
system( SHOWCMD );
}
http://www.heilqt.com/topic/556ea6e10654374f37a52a15
标签:
原文地址:http://www.cnblogs.com/findumars/p/5573946.html