我想可以读取byte流
用16进制表示就可以了
var
F:TFileStream;
passBuf:array[0..49]of byte;
I:INTEGER;
begin
memo1.Clear;
if not FileExists(Edit1.Text) then
exit;
F:=TFileStream.Create(Edit1.Text,fmOpenRead);
try
F.Seek($42,soFrombegin
ning);
F.Read(passBuf,50);
finally
F.Free;
end;
for i:=0 to 49do
memo1.lines.add(VarToStr(inttohex(passBuf,2)));
end;
再写进去的问题
将上面的read改为write,
F:=TFileStream.Create(Edit1.Text,fmOpenwrite);
来自:海无崖, 时间:2004-5-9 11:16:54, ID:2600008
To:wqhatnet
把文件头读出来没问题,但写回去总报错,请贴出写回去的源码.谢谢.
来自:wqhatnet, 时间:2004-5-9 12:32:32, ID:2600158 | 编辑
没有只读属性
没有被其他程序占用等
const
passBuf:array[0..39]of byte=
(
$29,$77,$EC,$37,$F2,$C8,$9C,$FA,$69,$D2
,$28,$E6,$BC,$3A,$8A,$60,$FB,$18,$7B,$36
,$5A,$FE,$DF,$B1,$D8,$78,$13,$43,$60,$23
,$B1,$33,$9B,$ED,$79,$5B,$3D,$39,$7C,$2A
);
var
F:TFileStream;
begin
if not FileExists(Edit1.Text) then
exit;
F:=TFileStream.Create(Edit1.Text,fmOpenWrite);
try
F.Seek($42,soFrombegin
ning);
F.Write(passBuf,40);
finally
F.Free;
end;
end;