string str = "some number in the form of a string"; double a; int b; a = atof( str.c_str()); //conversion to double b = atoi( str.c_str()); //conversion to int
If the string that is being converted is actually not a number, then it will return a zero.