Getting an integer with only using getchar()

This is a discussion on Getting an integer with only using getchar() within the C Programming forums, part of the General Programming Boards category; I need to get an integer number with only using getchar() and without pre knowing the number of digits in ...

Read in a character. if it's a digit, process it; if it's not, you're done.

Presumably you know how, if you already have 6, and then you see a 4, how to (numerically, not in terms of strings) turn that into 64, and then turn that into 644 when another 4 comes in, etc. (If not, look up "place value".)