Jump to content
  • Advertisement
Sign in to follow this  
Great_White

about scanf

This topic is 3797 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
unsigned chars are guaranteed to be the size of a byte. Because of this, you can simply read in a byte (char) and convert it to an integer.

Share this post


Link to post
Share on other sites
value already is an integer, but it's range is limited to values 0-255.

Or do you mean that your input is '0', '1', '2', ....

I'd usually refer to this as single-digit number, rather than 1-byte.

Easiest way would probably be:

int x = value - '0';

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!