Originally Posted by
JayCee++
Is it possible to convert a string to a char?
It depends on what you mean.
Originally Posted by
JayCee++
atoi will only convert char to int
No, atoi converts a null terminated string to int.
Originally Posted by
JayCee++
I need to convert the string to a char in order to get an integer out of it - or is ther a function to convert string to integer?
You can convert a std::string to an int. There are a few ways, one of which involves a stringstream, e.g.,
Code:
// str is a std::string
std::istringstream ss(str);
int num;
ss >> num;