C
coolmyf
Unregistered / Unconfirmed
GUEST, unregistred user!
我在程序中用到TMemoryStream类进行数据处理,用了两个函数,但是
发现有问题。
procedure procA(var thestream:TMemoryStream;tmpstr:string);
var i:integer;
begin
thestream.clear;
thestream.position:=0;
i:=thestream.write(tmpstr,length(tmpstr));
end;
procedure procB;
var mystream:TMemoryStream;
arr:array [1..6] of char;
i:integer;
begin
mystream:=TMemoryStream.create;
procA(mystream,'AAAAAA');
i:=mystream.read(arr,6);
showmessage(arr[3]);
end;
结果在showmessage中总是显示空字符,请问我错在哪里?谢谢!!!!
发现有问题。
procedure procA(var thestream:TMemoryStream;tmpstr:string);
var i:integer;
begin
thestream.clear;
thestream.position:=0;
i:=thestream.write(tmpstr,length(tmpstr));
end;
procedure procB;
var mystream:TMemoryStream;
arr:array [1..6] of char;
i:integer;
begin
mystream:=TMemoryStream.create;
procA(mystream,'AAAAAA');
i:=mystream.read(arr,6);
showmessage(arr[3]);
end;
结果在showmessage中总是显示空字符,请问我错在哪里?谢谢!!!!