Board index » cppbuilder » How to set Date + Time to a file

How to set Date + Time to a file


2003-09-17 09:37:16 PM
cppbuilder34
Hello,
How is it possible to set the Date and the Time to a file ?
I found the function FileSetDate() which set only the date but not the time
and I have not found a function named FileSetTime() !
Thanks for your help.
Regards
Jean-Claude Berlani
 
 

Re:How to set Date + Time to a file

Quote

I found the function FileSetDate() which set only the date but not the time
and I have not found a function named FileSetTime() !
Why do you think the time isn't being set? Here's the clip from Help:
extern PACKAGE int __fastcall FileSetDate(int Handle, int Age);
Description
FileSetDate sets the DOS date-time stamp of the file given by Handle to the
value given by Age. The DateTimeToFileDate function can be used to convert a
TDateTime object to a DOS date-time stamp.
The return value is zero if the function was successful. Otherwise the return
value is a Windows error code.
 

Re:How to set Date + Time to a file

"Berlani" < XXXX@XXXXX.COM >wrote in message
Quote
I try to used the function FileSetDate(), but the problem is we
need to give an Handle to this function. Then how to obtain an
Handle without open the file ?
You can't. The handle that is expected *is* the handle to an open file.
Quote
Because if I open the file to obtain an Handle and after change
Date and Time, when I will closed the file his Date and Time will
be adjusted at the closed time ! What is the best way to just
change Date and Time ?
That depends. Which exact timestamp are you trying to change? Files have
three different timestampes associated with them ("created", "last
modified", "last accessed"). FileSetDate() only deals in the "last
modified" timestamp.
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03
 

{smallsort}