Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <sys\utime.h>
    int utime( const char *path,
               const struct utimbuf *times );
    int _utime( const char *path,
               const struct utimbuf *times );
    int _wutime( const wchar_t *path,
                 const struct utimbuf *times );

    struct utimbuf {
        time_t   actime;    /* access time */
        time_t   modtime;   /* modification time */
    };

Description:
    The utime function records the access and modification times for the
    file identified by path.

    The _utime function is identical to utime.  Use _utime for ANSI naming
    conventions.

    If the times argument is NULL, the access and modification times of the
    file or directory are set to the current time.  Write access to this
    file must be permitted for the time to be recorded.

    If the times argument is not NULL, it is interpreted as a pointer to a
     utimbuf structure and the access and modification times of the file or
    directory are set to the values contained in the designated structure.
     The access and modification times are taken from the  actime and
     modtime fields in this structure.

    The _wutime function is identical to utime except that path points to a
    wide-character string.

Returns:
    The utime function returns zero when the time was successfully recorded.
     A value of -1 indicates an error occurred.

Errors:
    When an error has occurred,  errno contains a value indicating the type
    of error that has been detected.

    Constant     Meaning

EACCES
    Search permission is denied for a component of path or the times
    argument is NULL and the effective user ID of the process does not match
    the owner of the file and write access is denied.

EINVAL
    The date is before 1980 (DOS only).

EMFILE
    There are too many open files.

ENOENT
    The specified path does not exist or path is an empty string.


Example:
    #include <stdio.h>
    #include <sys\utime.h>

    void main( int argc, char *argv[] )
      {
        if( (utime( argv[1], NULL ) != 0) && (argc > 1) ) {
           printf( "Unable to set time for %s\n", argv[1] );
        }
      }

Classification:
    utime is POSIX 1003.1, _utime is not POSIX, _wutime is not POSIX

Systems:
     utime - All, Netware

    _utime - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32
    _wutime - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson