procedure TfrmMain.ReadImage(s,d:string); // 转化图像源文件转化为十六进制可读文件
var
sfile,dfile: file of byte;
ch:byte;
i,j:integer;
str:string;
begin
Assignfile(sfile,s);
Assignfile(dfile,d);
Reset(sfile);
ReWrite(dfile);
j:=0;
while not Eof(sfile) do
begin
read(sfile,ch);
str:=FormatHexToString(ch);
for i:=1 to length(str) do
begin
ch:=ord(str[i]);
write(dfile,ch);
end;
inc(j); // 换行
if j>15 then
begin
ch:=10;
write(dfile,ch);
ch:=13;
write(dfile,ch);
j:=0;
end;
end;
closefile(dfile);
closefile(sfile);
end;