i just can't believe i don't remember this....
too much time spent on 3d maths and not enough on simple c i guess ;(
anyway guys, heres the problem....
i''ve got an integer (65) that i have to store as a string as an ascii character, in this case, an A. 66 would be B etc... I thought itoa would work, but that just gave me "65" not "A". is there an itos? if so, i don''t seem to have it, or can''t find a reference for it...
please help me with this o so lame question...
thanks in advance...
Jason FeserCode Geek / Visuals Guyelasticmediaproductionshttp://www.elasticvisuals.com
I''ve never coded in C before, but I''m pretty sure you just need to do some type-casting:
(char) 65
I *think*
. I always get excited when it looks like a c question that I might be able to answer, so if this is wrong, then... oh well
. If I had a compiler I would check for you now.
(char) 65
I *think*


Trying is the first step towards failure.
Dunno if that would work, but that''s what I''d guess too. Also, I think creating a variable of type char and assigning the number to it would work too. The type cast is probably a better method though, assuming it works.
Peon
char in c (inherently unsigned) is nothing but a number from 0 to 255 ... only when printed it is interpreted as a character.
just remember to end your string with a zero byte (if youre actually going to use it with string functions).
cheers
just remember to end your string with a zero byte (if youre actually going to use it with string functions).
cheers
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement