Sets a file's modification time
Compatibility:This function is compatible with the following targets:
|
|
#include <utime.h>
int utimes(const char *path,  
struct timeval buf[2]);
Parameters for this facility are:
This function sets the modification time for the file specified in path to the second element of the array buf. Each element of the array buf is a timeval structure, which has the fields in Table 32.2.
|
This field
|
is the
| |
|---|---|---|
The first element of buf is the access time.
NOTE
#include <stdio.h>
#include <unix.h>
int main(void)
{
struct tm date;
struct timeval buf[2];
struct stat info;
/* Create a calendar time for
Midnight, Sept. 9, 1965.*/
date.tm_sec=0; /* Zero seconds */
date.tm_min=0; /* Zero minutes */
date.tm_hour=0; /* Zero hours */
date.tm_mday=9; /* 9th day */
date.tm_mon=8; /* .. of September */
date.tm_year=65; /* ...in 1965 */
date.tm_isdst=-1; /* Not daylight savings */
buf[1].tv_sec=mktime(&date);
/* Convert to calendar time. */
/* Change modification date to *
* midnight, Sept. 9, 1965. */
utimes("mytest", buf);
stat("mytest", &info);
printf("Mod date is %s", ctime(&info.st_mtime));
return 0;
}
This program prints the following to standard output:
Mod date is Thu Sep 9 00:00:00 1965
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000