2009/10/29 Graeme Geldenhuys <graemeg.li...@gmail.com>:
> On 29/10/2009, Mattias Gaertner <nc-gaert...@netcologne.de> wrote:
>>
>>
>> Text:=strnew(PChar(s));
>
> You read my mind. I was going to ask if it's ok to cast a PString to a PChar.
>
> Trying what you suggested, I get the following compiler error.
>
> project1.lpr(20,11) Error: Incompatible types: got "PString" expected "PChar"

This is probably dependant on compiler modes?

You may have to do it like this:

StrDispose(Text);
Text := StrAlloc(length(s) + 1);
StrPCopy(Text, s);

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

Reply via email to