the op asked for a way to make sure input was a valid int. well input in hex or octal is also a valid int.
A func that takes an int param(not const char* as atoi does, i never said that would work), can be passed a hex or octal number and thats fine because it is an int.
So I believe any function designed to check an ints validity has to take octal and hex into account. Dont you?