<<<<<
S.V.BADARI NARAYANA MURTHY wrote in message <31992@palm-dev-forum>...

hai all

   I want to store "?" into a Char*. if i give like this

Char* temp;
temp="?";

     it will store "\?". why its adding \ before ?. how to store only "?".
if
any one have idea regarding this, please help me.


>>>>>

Now aside from what Morgan wrote about what the backslash
really means, you have other problems.

First off, "Char *temp;" is declaring a variable which will be a
-pointer- to some memory into which you in intend to store
Chars ... but you never gave it any memory to point -to-.  Look
at MemHandleNew() and MemPtrNew().  Don't forget the matching
deletes once you're done w/ the memory !

Second, once you have allocated memory for storing your
string, the way to copy a string is with StrCopy().

That said, your code works because a string literal
is represented in code as a pointer ... but it is a pointer
to memory that can not be changed.  Therfore your code
worked ... but probably not the way you were intending.


--
-Richard M. Hartman
[EMAIL PROTECTED]

186,000 mi/sec: not just a good idea, it's the LAW!




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to