type convert problem
Managed C++/CLI
3
Posts
3
Posters
0
Views
1
Watching
-
string strd1 = "9"; int m=atoi(strd); Got the error: error C2664: 'atoi' : cannot convert parameter 1 from 'class std::basic_string,class std::allocator >' to 'const char *' how to change the second line to make it work?
-
string strd1 = "9"; int m=atoi(strd); Got the error: error C2664: 'atoi' : cannot convert parameter 1 from 'class std::basic_string,class std::allocator >' to 'const char *' how to change the second line to make it work?
This is the correct way: string strd1 = "9"; int m = atoi(strd1.c_str());
-
string strd1 = "9"; int m=atoi(strd); Got the error: error C2664: 'atoi' : cannot convert parameter 1 from 'class std::basic_string,class std::allocator >' to 'const char *' how to change the second line to make it work?