Thanks for the help...
Actually I´m using C++ and the examples that I must have seen should be in C
and by the way, where I said that was the 3rd I meant the 4th line in the
example, sorry and the casting is done at the MemHandleLock like you said,
and not at the MemHandleNew ;) ...
Thanks again...
-----Mensagem original-----
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]Em nome de Richard
Burmeister
Enviada em: quinta-feira, 5 de abril de 2001 20:22
Para: Palm Developer Forum
Assunto: RE: Casting?
Renato,
Are you using C++ ? C++ is much more picky about what syntax it will accept
and what it will do for you without asking. You are correct that casting
the result to a Char * is the thing to do. However, don't cast the
MemHandle. Many people do this even when using C, which normally doesn't
mind doing the conversion for you.
So, the code you should use is (possibly without the verbose comments):
// declare a handle to some memory
MemHandle testHandle;
// declare a pointer to Char
Char* ptext;
// get a handle on some memory
testHandle = MemHandleNew (12);
// lock it down, cast it to Char*, and assign the address to ptext
ptext = (Char *) MemHandleLock( testeHandle );
If this isn't clear to you, then either you should consult a book on C
and/or C++, or else perhaps I should have written even more comments. :)
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Renato
> R. Garcia
> Sent: Thursday, April 05, 2001 4:10 PM
> To: Palm Developer Forum
> Subject: Casting?
>
>
> Hi,
> in the code below,
>
> MemHandle testHandle;
> Char* ptext;
> testHandle = MemHandleNew (12);
> ptext = MemHandleLock( testeHandle );
>
> it gives me in the compilation
> Error : illegal implicit conversion from 'void *' to 'char *'...
>
> It´s in the 3rd line, right... to work I need to cast it, like :
> testHandle = (Char*) MemHandleNew (12);
> I´ve seen some examples from books that work without casting...
> I´m working with CW and I´ve already tried to change the projects
> settings->language settings...
>
> Is there any other way to do this ?
>
> Thanks ....
> Renato Garcia
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/