www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/30/13:45:55

Date: Wed, 30 Oct 1996 20:15:29 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Malcolm Taylor <malcolm AT manawatu DOT gen DOT nz>
Cc: djgpp AT delorie DOT com
Subject: Re: Setting Time/Date stamps of files.
In-Reply-To: <557b47$14v@news.manawatu.gen.nz>
Message-Id: <Pine.SUN.3.91.961030200621.21770M-100000@is>
Mime-Version: 1.0

On Wed, 30 Oct 1996, Malcolm Taylor wrote:

> 	I've run into a problem with lfn's and date/time stamps on files.
> After writing a file I wanted to set it's date and time and so I
> opened it again with _dos_open and used _dos_setftime to set it's
> date/time stamp. This doesn't work with lfns though (surprise
> surprise!). Is there a better/easier way?

Use `utime'.  Not only does it support LFNs (in v2.01) and can set both
access and modification times on LFN platforms, but it also is more
portable (it's POSIX AFAIK). 

> Is it possible to take a
> file opened for writing and set it's date/time stamp before it's
> closed (ie. take a FILE* and set it's date/time stamp)?

You better not rely on this for files that are open for writing, because 
usually closing such files also changes the time stamp.  If I understand 
your situation correctly, using `utime' is easier since you don't have to 
reopen the file.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019