Name

utime - change access and/or modification times of an inode

Library

libc.lib

Synopsis

  #include <utime.h>
  int utime (const char *file, const struct utimbuf *timep);

Return values

errno is set appropriately.


Detailed description

This interface is obsoleted by utimes.

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.


Examples

/**
*  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

         


Errors

The utime function may fail and set errno for any of the errors specified for the library function utimes.

See also

stat, utimes

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top