> From: S Santoso
>
> CharPtr fldChar;
> fldChar = CtlGetLabel(GetObjectPtr(objectID));
>
> The error is : illegal implicit conversion from 'const char *' to 'char *'
> However,
> fldChar = (CharPtr) CtlGetLabel(GetObjectPtr(objectID));
> Then, the error is out.
>
> My question is : Why by adding type of variable (CharPtr) is eliminating
> the error?
>
In the docs for SDK 3.5, you'll see that CtlGetLabel returns const Char *,
not Char *, or CharPtr. So, the compiler is doing you a favor by refusing
to implicitly convert one type to another. When you put (CharPtr) in front,
you are explicitly converting the const Char * to a CharPtr, so the compiler
does what you tell it to do without complaining.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/