2011年5月21日 星期六

[C++] String變數使用atoi函式

在寫程式的時候遇到這個問題
因為atoi函式只吃char*
上網GOOGLE一下找到了解決之法



string x;
int temp=atoi(x.c_str());
c_str()可以轉換string成為char*

沒有留言:

張貼留言