program makehex; const blklen = 16; var bff: array [0..blklen-1] of byte; srcf: file; dstf: text; nrread, c: integer; function toHex(b: byte): string; const hex: array [0..15] of char = '0123456789ABCDEF'; begin toHex := hex[b div 16] + hex[b mod 16]; end; begin if paramcount <> 2 then begin writeln('Usage: tohex '); halt; end; assign(srcf, paramstr(1)); reset(srcf, 1); assign(dstf, paramstr(2)); rewrite(dstf); while not eof(srcf) do begin blockread(srcf, bff, blklen, nrread); write(dstf, ':'); for c := 0 to nrread-1 do write(dstf, toHex(bff[c])); write(dstf, #13, #10); end; close(dstf); close(srcf); end.