Re: Convert Ascii to char
- From: Chris Dollin <eh@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Aug 2007 14:50:29 GMT
meendar wrote:
I am having a character pointer which contains ascii values.
That's unlikely. `char*` variables contain pointer values,
not ascii character values. The characters the pointer points
to may, or may not, be encoded in ascii.
i just
want to convert all these ascii values to respective characters and
again store it in another character pointer.
I /think/ you mean you want to copy a string from one place
to another.
If the expression `source` has value pointer to string of length N,
and the expression `dest` has value pointer to an array of chars
of length at least N+1, then executing the expression:
strcpy( dest, source )
will copy the string from `source` to `dest`. To use this expression,
you should ensure you've #included <string.h>.
This code doesn't care about ascii. In the unlikely event that matters,
you'll have to explain your problem more centrally.
Note that it's your responsibility to ensure that `dest` points to
enough characters. If it doesn't, your program will be broken, even
if nothing bad /seems/ to happen.
--
Third Floor And Still OK! Hedgehog
"Who do you serve, and who do you trust?" /Crusade/
.
- Follow-Ups:
- Re: Convert Ascii to char
- From: meendar
- Re: Convert Ascii to char
- References:
- Convert Ascii to char
- From: meendar
- Convert Ascii to char
- Prev by Date: Re: Dynamically resizing a buffer
- Next by Date: Re: Malcolm's new book - Chapter 1 review
- Previous by thread: Re: Convert Ascii to char
- Next by thread: Re: Convert Ascii to char
- Index(es):
Relevant Pages
|