Hello!
How to convert string to int?
Is there any standart function for this.
atoi() doesn't work. one way is to convert string to char array and then atoi().
is there something short like
int x=str.toint();
Printable View
Hello!
How to convert string to int?
Is there any standart function for this.
atoi() doesn't work. one way is to convert string to char array and then atoi().
is there something short like
int x=str.toint();
string str("234");
int var=atoi(str);
gives compiler error because it can handle only
char arrays;
I find that stringstream is useful.
Quote:
gives compiler error because it can handle only
char arrays;
Quote:
string whatever="12345678";
atoi(whatever.c_str());