How to read in a single digit integer from file
Posted on 2003-03-15
I have a file of a very long integer like : 43242348913123141341321487398432
How do I using ifstream to read in only 1 digit at a time?
inFile >> number; but i think it reads in the whole line and does not give me a single digit number.
I have tried using getline first to store it in array, but I cannot get the correct integer value from the array because they'd be stored in char.
Is there a simple way to get just 1 digit at a time, without having to store it in char array then somehow convert it back to int again?
thank you very much