SO following code: ===================
{$mode objfpc} {$H+}
procedure ExtractFromText(var FSrchRec: Pointer);
var
pAddr: ^TSearchRec;
msSize :SizeUint;
Buffer: AnsiString;
begin
pAddr := FSrchRec;
msSize := pAddr^.Size; //now 77038 from 1st entry
try
Buffer := System.AllocMem(msSize + 1);
=======================
compiler error
Error: Incompatible types: got "Pointer" expected "AnsiString"
Say What???
^^^^^^^^^^^^^^^^^^^^^^^^^
according to DOCS:
http://www.freepascal.org/docs-html/rtl/system/allocmem.html ^^^^^^^^^^^^
AllocMem
Allocate and clear memory.
Declaration
Source position: heaph.inc line 93
function AllocMem( Size: PtrUInt ):pointer;
Description
AllocMem calls getmem GetMem, and clears the allocated memory, i.e. the allocated memory is filled with Size zero bytes.
AllocMem returns a Pointer and the compiler should coerce the address returned into an AnsiString address.
FYI, if I use a 'PChar', no error msg!
My goal is to allocate enough memory to hold an entire HTML file + trailing null.
I want the memory initialized to null for debugging.