Since atoi() is a C function, it needs a C (char*) string. Try
int lineInt= atoi(line.c_str()); //convert the string to an integer
Sorry I forgot to mention that. It's been too long since I've done C++ programming using std::string.
Googling for "c++ std::string to int" will turn up some more C++ish ways to do it using string I/O streams, etc., but I find those way over the top. Like using a canon to swat flies 8-)
--Mark