[fpc-pascal]Re: force ansistrings to be copied on duplication

Florian Klaempfl fpk at gmx.org
Thu Jul 29 08:35:38 CEST 2004


Marc Santhoff wrote:
> Hi again,
> 
> 
> Am Do, den 29.07.2004 schrieb Marc Santhoff um 06:33:
> 
>>--- like this ---
>>var
>>  s1:PChar='something';
> 
> 
> this should be
> 
>     s1:AnsiString='something';
> 
> of course ... 


Use UniqueString(s2) to get a real copy.
> 
> 
>>  s2:PChar;
>>
>>begin
>>  s2 := s1;
>>  if (s1 <> s2) then
>>    writeln('Okay')
>>  else
>>    writeln(':-( only a doubled pointer');
>>
>>end;
>>
>>---
> 
> 
> Sorry,
> Marc
> 
> 
> 
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 





More information about the fpc-pascal mailing list