DelphiFAQ Home Search:
General :: Programming :: Delphi
General Delphi related information.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Allocating a large buffer (new)

This is a newer solution how to allocate a large buffer without using GetMem().

// Using large buffers without using GetMem()

 var
   s0 : string;
   s : PChar;
   p : Pointer;
 
 begin
   // Allocate 1 MB, it will be automaticly dealocated by Delphi when
  // terminating the application or leaving a function or procedure.
  SetLength(s0, 1048576);
   s:=PChar(s0);
   p:=Pointer(PChar(s0));
 end.
You don't like the formatting? Check out SourceCoder then!
Generated 4:01:20 on Jul 4, 2020