RAD Studio VCL Reference
TCustomMemoryStream.SetPointer Method

Replaces the memory buffer associated with the memory stream.

procedure SetPointer(Ptr: Pointer; Size: Longint);
__fastcall SetPointer(void * Ptr, Longint Size);

Use SetPointer to set the internal memory buffer, Memory, to be the value passed in by Ptr. Size is the number of bytes Ptr points to. 

Descendants of TCustomMemoryStream should use SetPointer to associate the memory stream with the memory buffer that holds the data for the memory stream.

Note: SetPointer does not free the existing value of Memory, if any, when it replaces the memory buffer. Descendants of TCustomMemoryStream that use SetPointer to replace the stream's memory pool should free the memory pointed to by the Memory property before calling SetPointer to replace the memory buffer.


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!