RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TMemoryStream.SetSize Method

Sets the Size property of the memory stream.

Pascal
procedure SetSize(NewSize: Longint); override;
C++
virtual __fastcall SetSize(Longint NewSize);

Use SetSize to set the Size of a memory stream before filling it with data. SetSize allocates the memory buffer to hold NewSize bytes, preserving as much of the existing data as possible. 

Use SetSize before filling the memory buffer with data from various sources, or from a portion of another stream. If the intended contents of the memory stream is exactly the same as the contents of another stream or file, use LoadFromStream or LoadFromFile instead. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!