Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

peter86

Convert a char to an integer

This topic is 5890 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
You don''t need to convert a char to an integer - it''s an implicit promotion. Do you mean something else?

Share this post


Link to post
Share on other sites
wwhat that guy was doing is typecasting, but i dont understand what the first guy was doing.
is that STL?

<marquee width=100% direction=right><table nostyle="filter:glow(color=red,strength=3)"><table nostyle="filter:shadow(color=blue,direction=left)">Can someone be nice and help me on my way to be the next Hideo Kojima?</table></table></marquee>

Share this post


Link to post
Share on other sites
quote:
Original post by Pipo DeClown
wwhat that guy was doing is typecasting, but i dont understand what the first guy was doing.


That is typecasting as well.
quote:

is that STL?


No, it''s standard C++.

Share this post


Link to post
Share on other sites
Go IndirectX!

<marquee width=100% direction=right><table nostyle="filter:glow(color=red,strength=3)"><table nostyle="filter:shadow(color=blue,direction=left)">Can someone be nice and help me on my way to be the next Hideo Kojima?</table></table></marquee>

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
the guy was probably asking how to parse an int from a char* used as a string.

Share this post


Link to post
Share on other sites
if it is just a single char that is a number and you want an int to be equal to that number

  
char c = ''5'';
int num = c - ''0'';

num is now equal to 5


"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!