![]() |
| | #1 |
| Registered User Join Date: Mar 2003
Posts: 15
| How can I read one number at a time? Something like this: 1429943983... I want to read in the one, then the four, and so on. My first thought was to use get. Something like fin.get(number); But this statement only seems to accept a char, not an int. I am at a loss, short of reading in a char and converting to an int through 10 if statements. Any help would be great. |
| Bad_Scooter is offline | |
| | #2 |
| +++ OK NO CARRIER Join Date: Oct 2001
Posts: 10,628
| Do that. Read a character, convert it to a number. Subtract the character value of zero from the character number to get its numeric value. Example: cout << "'4' - '0' = " << '4' - '0' << endl; Enjoy. Quzah.
__________________ Hundreds of thousands of dipshits can't be wrong. Are you up for the suck? |
| quzah is offline | |
| | #3 |
| Registered User Join Date: Mar 2003
Posts: 15
| Thanks, that's what I'll do, I just thought there may have been an easier way. |
| Bad_Scooter is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Read until negative number | m_user | C Programming | 10 | 04-03-2009 06:38 AM |
| Number Guessing | blacknapalm | C Programming | 2 | 10-01-2008 01:48 AM |
| Read and set\change system time | Hexxx | C++ Programming | 9 | 01-02-2006 07:11 AM |
| how to read hard disk serial number | toufiq_raja | C Programming | 4 | 08-18-2005 10:08 PM |
| airport Log program using 3D linked List : problem reading from file | gemini_shooter | C Programming | 3 | 03-04-2005 02:46 PM |