copy string into integer variable
how to copy string into integer??
like..
string str1="12345";
int no;
no=str1;
You can use function atoi.
for example.
1 2 3 4
|
std::string str1( "12345" );
int i = std::atoi( str1.c_str() );
std::cout << "i = " << i << std::endl;
|
Last edited on
thank you vlad:)
Topic archived. No new replies allowed.