doomgod

Size comparison

Oct 18th, 2012
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.50 KB | None | 0 0
  1. program sizecmpr;
  2.  
  3. {$APPTYPE CONSOLE}
  4. {$WARN UNSAFE_CODE OFF}
  5.  
  6. var
  7.   f1,f2:File;
  8.   fs,fs2:Longword;
  9.  
  10. begin
  11.   assignfile(f1,paramstr(1));
  12.   assignfile(f2,paramstr(2));
  13.   reset(f1,1); reset(f2,1);
  14.   seek(f1,filesize(f1)-4);
  15.   blockread(f1,fs,4);
  16.   fs2:=filesize(f2);
  17.   if fs<>fs2 then
  18.   begin
  19.     write('Wrong size for ',paramstr(2),': expected ',fs,' but got ',fs2);
  20.     seek(f1,filesize(f1)-4); blockwrite(f1,fs2,4);
  21.     writeln('. Fixed');
  22.   end;
  23.   closefile(f1); closefile(f2);
  24. end.
Advertisement
Add Comment
Please, Sign In to add comment