home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
d
/
drcpas10.zip
/
CRCTEST.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-11-17
|
935b
|
47 lines
{$A+,B-,D-,E-,F-,I+,L-,N-,O-,R-,S+,V-}
{$M 16384,0,655360}
program crctest;
(* compute CRC of a file as an example of crc32.pas *)
uses dos, crc32, tools, dostools;
const
BUFSIZE = 16384;
type
buftype = array[1..BUFSIZE] of byte;
var
name : pathstr;
crc : longint;
buf : buftype;
count : word;
f : file;
begin
writeln ('CRC-32 Turbo Pascal source by David Conrad');
writeln;
if paramcount = 0 then
begin
writeln ('crctest <file>');
halt (1);
end;
name := upperstr(paramstr(1));
if not exist(name) then
begin
writeln (name, ' not found');
halt (2);
end;
assign (f, name);
filemode := 0;
reset (f, 1);
crc := INITCRC;
repeat
blockread (f, buf, BUFSIZE, count);
crc := addbfcrc (buf, count, crc);
until count = 0;
crc := not crc;
close (f);
writeln (' ', lowerstr(hexl(crc)), ' : ', name);
end.