FileSetDate
Moduł: SysUtils
function FileSetDate(Handle: Integer; Age: Integer): Integer;
Funkcja ustawia datę modyfikacji pliku. Parametr Handle musi wskazywać na uchwyt pliku zwracany przez funkcje FileOpen lub FileCreate. Age to data zapisana w postacii 32-bitowej liczby Integer. Aby przekonwertować datę z formatu zapisanego w TDateTime na Integer, można użyć funkcji DateTimeToFileDate.
Oto przykład zmiany daty modyfikacji wskazanego pliku:
program Foo;
uses Dialogs, SysUtils;
var
S : String;
FileHandle : Integer;
begin
if PromptForFileName(S) then
begin
FileHandle := FileOpen(S, fmOpenWrite);
try
FileSetDate(FileHandle, DateTimeToFileDate(Now));
finally
FileClose(FileHandle);
end;
end;
end.
Zobacz też: