Fog Creek Software
Discussion Board

solution to atoi problem by michael

please correct me if I am wrong!
The solution provided for the right to left method has  a slight problem. If the string is "78p34", the solution presented gives the result as 7834 where as we are looking for just 78. Couple more lines to reset values of iRetVal = 0 and iTens = 1 if in case a non-numeric char is found should solve this problem.

Varun Shastri
Friday, January 9, 2004

Or you could just check it at this point:
    while (*pCur)

And whoever does this website... shouldn't you update it?

Friday, March 5, 2004

*  Recent Topics

*  Fog Creek Home