help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Procedures and functions] Reference for unit 'BaseUnix' (#rtl)

FpUtime

Set access and modification times of a file (touch).

Declaration

Source position: line 0

function FpUtime(

  path: pChar;

  times: pUtimBuf

):cint;

function FpUtime(

  path: AnsiString;

  times: pUtimBuf

):cint;

Description

FpUtime sets the access and modification times of the file specified in Path. the times record contains 2 fields, actime, and modtime, both of type time_t (commonly a longint). They should be filled with an epoch-like time, specifying, respectively, the last access time, and the last modification time. For some filesystem (most notably, FAT), these times are the same.

The function returns zero on success, a nonzero return value indicates failure.

Errors

Extended error information can be retrieved using fpGetErrno.

sys_eaccess
One of the directories in Path has no search (=execute) permission.
sys_enoent
A directory entry in Path does not exist or is a symbolic link pointing to a non-existent directory.

Other errors may occur, but aren't documented.

See also

FpTime

  

Return the current unix time

FpChown

  

Change owner of file

FpAccess

  

Check file access

Example

Program Example25;

{ Program to demonstrate the UTime function. }

Uses BaseUnix,Unix,UnixUtil;

Var utim : utimbuf;
    year,month,day,hour,minute,second : Word;

begin
  { Set access and modification time of executable source }
  GetTime (hour,minute,second);
  GetDate (year,month,day);
  utim.actime:=LocalToEpoch(year,month,day,hour,minute,second);
  utim.modtime:=utim.actime;
  if Fputime('ex25.pp',@utim)<>0 then
    writeln ('Call to UTime failed !')
  else
    begin
    Write ('Set access and modification times to : ');
    Write (Hour:2,':',minute:2,':',second,', ');
    Writeln (Day:2,'/',month:2,'/',year:4);
    end;
end.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505