Hi Guys,
I want translate a number string into int type. such as "21354" to (int)21354. but the output is not correct. I can not find bugs. Please help me. Thanks.
It is in the C Standard Library. It is standard according to SVr4, POSIX.1-2001, 4.3BSD, C99, C89 and POSIX.1-1996. http://linux.die.net/man/3/atoi
It is not, however, C++. If you plan to use C++, then use C++ and avoid old stuff like atoi(). blackcoder41 has done you a double service already by both posting nice, drop-in code you can use and linking to a very well-written article which exactly answers your topic question.
I only know because when I first began coding I used atoi() and itoa(), and was both surprised and peeved that the latter was so, well, non-portable (making code I wrote at home not work at school). Then I learned about such things as standards...