Previous: GetLocaleStr function To the Table of Content Next: Halt procedure

- 4.62.2.36 -
Standard Units
System Unit
System Unit Procedures and Functions

GetMem procedure

Targets: MS-DOS, OS/2, Win32

System Unit

Creates a dynamic variable of the specified size and puts the address of the block in a pointer variable.

Declaration:
procedure GetMem(var P: Pointer; Size: Longint);
Remarks:
To reference the new variable, use P^. If GetMem finds that there is an insufficient amount of free heap, a runtime error is generated.

Example:
{$ifndef __CON__}
  This program must be compiled as console application only
{ $endif}
uses Crt;
var
  ScrnImage : Pointer;
  Size      : Longint;
begin
  Size := SaveScreenSize(10, 10, 20, 20);
  GetMem(ScrnImage, Size);
  if ScrnImage = nil then Halt(1);
  SaveScreen(10,1 0, 20, 20, ScrnImage^);
  ClrScr;
  ...
end.
See also:
FreeMem


Previous: GetLocaleStr function To the Table of Content Next: Halt procedure
GetLocaleStr function Table of Content Halt procedure

- 4.62.2.36 -