If you are not too hot on using dynamic memory - an easy way to manage it is
by using strings rather than using untyped pointers. If you want a pointer
to the dynamic memory the just ask for a PChar( String ) - mind you it
depends on who is going to free up the memory later.
if you are using pointers for both source and destination, then the Move
syntax looks like
Move( Src^, Dest^, Size );
Myles.
-----Original Message-----
From: Tony Sinclair [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 02, 2000 4:08 PM
To: Multiple recipients of list delphi
Subject: [DUG]: Dynamic Memory Allocation within Instance
Hi all,
an extension of this morning's question regarding copying memory. If I have
an untyped pointer as a private member variable defined in a class, that is
assigned nil at creation, how do I get memory for it and copy memory into
the newly allocated space? I basically have a function that receives a
pointer and a size then I perform a GetMem and a move. This seems to be
overwriting the memory in the object (I have also an integer thats getting
trashed, thats fine if I comment out the memory allocation). Am I going to
have to have a statically declared array of bytes to do this?
Thanks in advance
Tony Sinclair
Holliday Group Limited
Christchurch
New Zealand
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"