B
BiPigBen1001
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大侠,你们好,本人想实现一个如下功能,我创建一个TMemoryStream对象,然后往这个流中写入'abcdefg',我想通过TMemoryStream把流的内容拷贝到一个字节数组中,可惜报错,往各位前辈指教var pStream:TMemoryStream; ss:String; pp:array of byte; pLength:Integer;begin ss:='abcdefg'; pLength:=Length(ss); pStream:=TMemoryStream.Create; pStream.WriteBuffer(ss[1],length(ss)); pStream.Seek(0,0); setLength(pp,pLength); Move(Pointer(Integer(pStream.memory))^,pp,pLength); freeAndNil(pStream); //end;我跟踪了PP,这个值不对,而且还报错