Beispiel:
program timekor;
{$F+}
uses dos,dos2,crt,crt1;
var
jh,j,mon,tag,j1,mon1,tag1:byte;
inf:word;
f:file of byte;
begin
assign(f,'timekor.dat');
setfattr(f,Archive);
getcmosdate(jh,j,mon,tag);
if jh<20 then halt(0);
if j>=94 then j:=j-94;
{$I-}
reset(f);
{$I+}
if ioresult<>0 then begin
rewrite(f);
write(f,j,mon,tag);
end
else begin
read(f,j1,mon1,tag1);
if mon1>mon then inc(j1);
end;
setcmosdate(jh,j1,mon,tag);
seek(f,0);
write(f,j1,mon,tag);
close(f);
inf:=ReadOnly+Hidden;
setfattr(f,inf);
inf:=2000+j1;
setdate(inf,mon,tag);
halt(0);
end.
|