Re: [fpc-pascal] PChar resize

2011-05-11 Thread Anton Shepelev
In addition to what Mattias has said, the following works pretty well: Program StrTest; Var a:Pchar; Begin a:=PChar(nil); Reallocmem(a,20); //ko a[0] := 'A'; a[1] := 'n'; a[2] := 't'; a[3] := Chr(0); WriteLn('Done: ', a); End. Anton ___ fpc-pascal mail

Re: [fpc-pascal] PChar resize

2011-05-11 Thread Mattias Gaertner
On Wed, 11 May 2011 08:31:02 -0500 Luis Fernando Del Aguila Mejía 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; >

[fpc-pascal] PChar resize

2011-05-11 Thread Luis Fernando Del Aguila Mejía
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:='x'; for i:=0 to 9 do Writeln('[',i,']',a[i]);