#include <utime.h>
|
int
utime (const char *file, const struct utimbuf *timep); |
errno is set appropriately.
The utime function sets the access and modification times of the named file from the actime and modtime fields of the struct utimbuf pointed at by timep.
If the times are specified (the timep argument is non- NULL) the caller must be the owner of the file or be the super-user.
If the times are not specified (the timep argument is NULL) the caller must be the owner of the file, have permission to write the file, or be the super-user.
/** * Detailed description: Sample usage of utime system call * Preconditions: Example.txt file should exist in the working directory **/ #include <stdio.h> #include <utime.h> int main() { struct utimbuf Time ; if(utime("Example.txt" , &Time) < 0 ) { printf("Utime call failed \n") ; return -1 ; } printf("Utime call succeded \n") ; return 0 ; }
Output
Utime call succeded
© 2005-2007 Nokia |