SysUtilsFileGetSetDate (C++)
Description
This example illustrates the FileGetDate and FileSetDate functions from the SysUtils unit. In the case of a file called "test.txt", first get the date and time from that file, and then change it.
Code
int _tmain(int argc, _TCHAR* argv[])
{
THandle h;
int fdate;
/* Open a file. */
h = FileOpen("test.txt", fmOpenRead);
/* Get the date from the file. */
fdate = FileGetDate(h);
/* Close the file. */
FileClose(h);
/* Increment the old date by one hour, then apply the new date. */
FileSetDate("test.txt",
DateTimeToFileDate(
IncHour(FileDateToDateTime(fdate), 1)));
return 0;
}
Uses
- System.SysUtils.FileGetDate ( fr | de | ja )
- System.SysUtils.FileSetDate ( fr | de | ja )
- System.SysUtils.FileDateToDateTime ( fr | de | ja )
- System.DateUtils.IncHour ( fr | de | ja )