Originally Posted by
Sorin
If you are allowed to use scanf, you could just use that. Remember that scanf returns a value, and that value is the number of items that were successfully filled. So if you want to get one integer from the user (you can check to see if it's a single digit after the scanf itself succeeds), and they enter an integer, then scanf will return 1. If they enter a character, scanf will return 0. Depending on if 1 or 0 is returned, you can go from there (if single digit, proceed to next step, if not single digit or if return is 0, try again).
Otherwise, whiteflags link works for the string parsing route.