delorie.com/djgpp/doc/libc/libc_845.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

utime

Syntax

 
#include <utime.h>

int utime(const char *file, const struct utimbuf *time);

Description

This function sets the modification timestamp on the file. The new time is stored in this structure:

 
struct utimbuf
{
    time_t  actime;  /* access time (unused on FAT filesystems) */
    time_t  modtime; /* modification time */
};

Note that, as under DOS a file only has a single timestamp, the actime field of struct utimbuf is ignored by this function, and only modtime field is used. On filesystems which support long filenames, both fields are used and both access and modification times are set.

If file is a directory, the function always fails, except on Windows 2000 and Windows XP, because other systems don't allow changing the time stamp of a directory.

Return Value

Zero for success, nonzero for failure.

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

 
struct utimbuf t;
t.modtime = time(0);
utime("data.txt", &t);


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004