C++でString (char配列)をintegerに変換する方法
実現方法は色々あると思いますが、その内の一つをご紹介。
atoi.cpp
実行結果:
$ g++ atoi.cpp
$ ./a
std::atoi(string123.c_str()) is 123(int)
atoi(str) = 0
実現方法は色々あると思いますが、その内の一つをご紹介。
atoi.cpp
実行結果:
$ g++ atoi.cpp
$ ./a
std::atoi(string123.c_str()) is 123(int)
atoi(str) = 0