home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / date / touch / chtd.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-08-26  |  745 b   |  35 lines

  1. uses dos;
  2.  
  3. var f : file;
  4.     fname : string[12];
  5.     thedate : datetime;
  6.     p : longint;
  7.  
  8. begin
  9.   writeln('Change the date and time of a file.');
  10.   writeln;
  11.   if paramcount<>0 then fname:=paramstr(1)
  12.   else
  13.     begin
  14.       write('What is the name of the file you want to change? ');
  15.       readln(fname);
  16.     end;
  17.   assign(f,fname);
  18.   {$I-}  reset(f);  {$I+}
  19.   if ioresult<>0 then
  20.   begin
  21.     writeln('Error in opening ',fname);
  22.     halt(1);
  23.   end;
  24.   with thedate do
  25.   begin
  26.     write('Please enter the time ( hour minute sec ) : ');
  27.     readln(hour,min,sec);
  28.     write('Please enter the date ( day month year ) : ');
  29.     readln(day,month,year);
  30.   end;
  31.   packtime(thedate,p);
  32.   setftime(f,p);
  33.   close(f);
  34. end.
  35.