T
txyx
Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个程序:
function THexConversion.ConvertReadStream(Stream:TStream
BufferChar;
BufSize:integer): integer;
var s:string;
buf:array[1..256] of char;
i,n:integer;
begin
Result := 0;
n := Stream.Read(buf,256);
if n = 0 then Exit;
for i := 1 to n do
begin
AppendStr(s,IntToHex(ord(buf),2)+' ');
if i mod 4 = 0 then AppendStr(s,' ');
if i mod 16=0 then AppendStr(s,#13#10);
end;
AppendStr(s,#13#10);
StrPCopy(Buffer,s);
Result := length(s);
if Stream.Position and $FFF = 0 then MainForm.Progress(Stream.Position);
end;
好像是把文件转换流格式后,再处理输出。
每256个字节处理一次,我只想要将前256个字节取出来单独存放,怎么办?
因为程序循环调用该函数,前256字节早就被替换了。
function THexConversion.ConvertReadStream(Stream:TStream
BufferChar;
BufSize:integer): integer;
var s:string;
buf:array[1..256] of char;
i,n:integer;
begin
Result := 0;
n := Stream.Read(buf,256);
if n = 0 then Exit;
for i := 1 to n do
begin
AppendStr(s,IntToHex(ord(buf),2)+' ');
if i mod 4 = 0 then AppendStr(s,' ');
if i mod 16=0 then AppendStr(s,#13#10);
end;
AppendStr(s,#13#10);
StrPCopy(Buffer,s);
Result := length(s);
if Stream.Position and $FFF = 0 then MainForm.Progress(Stream.Position);
end;
好像是把文件转换流格式后,再处理输出。
每256个字节处理一次,我只想要将前256个字节取出来单独存放,怎么办?
因为程序循环调用该函数,前256字节早就被替换了。