bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Mon Dec 20, 2010 4:59 pm |
|
|
Let's say your int (we'll call it 'result') is what you pull in from the keypad.
Since it's a 4x4 keypad (I'm making this up) you've wired up 'result' to equal a range of 0-15
If you want to PRINT 0 to 15, you want to convert that to ascii.
The easiest way is to simply do this:
printf("%u", result);
This will print result (which is an unsigned int) anywhere from 0-15.
If you want padded preceding 0's,
printf("%02u", result);
This will print 00-15 (because of the 2).
And that's it.
Easy.
PrintF -- it's your friend. _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|