How Can I convert stringc to int?
How Can I convert stringc to int?
I have a problem at converting stringc type file to int. So, I have to get text from editBox and getText() returns stringc type data and I need to convert it to int format for futher use.
you can use the good old C function atoi(...):
Code: Select all
int val = atoi(txt.c_str());
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Doesn't it return stringw? In that case you can force conversion by putting the c_str() result into a stringc object and get str_c() on that one again. Also, Irrlicht provides a strtol10 method which can convert a char* to an unsigned int, or use fast_atof and cast the result to int (in order to handle also negative numbers).