Hi,

I have a following problem. I have a number in string, for example "123456" and I'd like to convert it to int. This would not be a problem if I knew that the input number will always fit into an 32 bit integer. So if it won't I should take only the first 31 bit of that number, show some error and the program should continue. I know that there is the atoi function which I think can handle the overflow but I need to write my own function and I don't know how.

Thx for any help.