You may want to look up strtod or strto[u]l. If you are trying to use these C-style functions with a std::string, look at the c_str() member function too.
I think that your problem is you are trying to pass a string object to the atoi function.
the way that your book uses it is atoi(char *) using a C-style string, not a string object. I'm not sure if it does have an overloaded version using the string object. What you could do is just have your function return yourString.c_str() and it should work.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.