The c_str method exists for this purpose.
int columns = atoi(line.c_str());
BTW your code should read
while (getline (file,line))
{
...
Just because the file is 'good' does not mean the next getline will succeed, only that the last getline succeeded. Use getline directly in your while condition to tell if you did actually read a line.