MyStream := TMemoryStream.Create;
... write to stream ...
GetMem( MyPointer, MyStream.Size );
MyPointer^ := MyStream.Memory^;
But I get an error on the last line, saying "Operator not applicable to this
operand type". How else would I copy the memory?
--
Anthony Wertz (aka Anomy)
Webmaster, RPG Infinity
http://rpginfinity.com
--
Koms Bomb
*****Pardon my poor English*****
---------------------
Don't worry,be happy.
"Anthony T.W." <ano...@hotmail.com> wrote in message
news:3de42e96$1...@newsgroups.borland.com...
Use the ReadBuffer method of TMemoryStream. The ...^:=...^ only works
for typed pointers. The compiler needs to know how much to move.
Sometimes you can use typecasting as a way to move small chunks of
memory this way. But for a TMemoryStream, this is obviously not an
option.
Renate
The method header is
procedure TStream.ReadBuffer(var Buffer; Count: Longint);
so I would use
MyStream.ReadBuffer(MyPointer^, MyStream.Size);
Regards, JohnH
Yes, it's a mistake of mine.
I often confuse the usage of pointer in Delphi because it's a little strange
comparing to C.
move(MyStream.Memory^, MyPointer^, MyStream.Size);
"John Herbster (TeamB)" <herb-sci at novus-tele.net> wrote in message
news:3de44425$1...@newsgroups.borland.com...
--
Koms Bomb
*****Pardon my poor English*****
---------------------
Don't worry,be happy.
"Peter Below (TeamB)" <10011...@compuXXserve.com> wrote in message
news:VA.0000969...@antispam.compuserve.com...
> In article <3de4...@newsgroups.borland.com>, Koms Bomb wrote:
> > I often confuse the usage of pointer in Delphi because it's a little
strange
> > comparing to C.
> >
>
> No, you get that wrong. The way C handles pointers is a bit strange
compared
> to Delphi <g>.
>
> --
> Peter Below (TeamB)
> Use the newsgroup archives :
> http://www.mers.com/searchsite.html
> http://www.tamaracka.com/search.htm
> http://groups.google.com
> http://www.prolix.be
>
>