Sign in Join
FPDoc Onlineexperiment

FileSetDateUTF8 function

In unit LazFileUtils

Sets the last modification time for the file.

Declaration

pascal
function FileSetDateUTF8(const FileName: string; Age: LongInt): LongInt

Arguments

FileName

File name to update in the function.

Age

New value for the last modification time.

Function result

Last error number in the function.

Description

FileSetDateUTF8 is a Longint function used to set the last modification time for the file to the specified Age in FileDate format. Use DateTimeToFileDate to convert a TDateTime value to FileDate format.

For the Windows environment, a handle is created for the specified file name, and SetFileTime is called to store the updated file age. For UNIX-like environments, FileSetDate in SysUtils is called to set the file age. InvalidateFileStateCache is also called for the specified file name.

The return value is the value from GetLastError; a non-zero value indicates that an error has occurred.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.