
Touching a file (set to current time and date)
Quote:
>> I need to "touch" a file from within a C program. In other words, I
>> need to update the time and date of the file to the current time and
>> date. Is there a function that does this ?
There is no C language function that does this, the C language doesn't define
attributes for files such as timestamps.
Quote:
>> I'm running the program
>> under Unix.
Unix programming resources are best asked about in comp.unix.programmer.
Quote:
>man utime gives :
> utime(2)
>utime(2)
> NAME
> utime - set file access and modification times
> SYNOPSIS
> #include <utime.h>
> int utime(const char *path, const struct utimbuf *times);
Be clear that this is POSIX/Unix specific. Somebody reading the newsgroup
who is not aware of Unix man conventions and formats may not realise this.
Also note that under Unix a file has three timestamp values but this only
sets two of them.
--
-----------------------------------------
-----------------------------------------