On Wed, 11 May 2011 08:31:02 -0500
Luis Fernando Del Aguila Mejía <luis3...@ec-red.com> wrote:

> Hi, I have two questions about PChar.
> 
> Why Reallocmem function does not work with PChar?
> How to increase the size of PChar without using Strings unit?
> 
> Thanks.
> 
> {$codepage utf8}
> Var a:Pchar;
>     i:byte;
> Begin
> ReturnNilIfGrowHeapFails:=true;
> a:='xxxxxxxxx';
> for i:=0 to 9 do Writeln('[',i,']',a[i]);
> Writeln('-------');
> Reallocmem(a,20);  //ko 

Reallocate re-allocates memory on the heap.
A string constant is not on the heap.

Mattias
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to