“It's not working” == it will not compile. Crank up your compiler warnings to max and look at the top one — this will give you the most important clue. GCC tells me:
a.cpp: In function 'int main()':
a.cpp:19:48: error: no matching function for call to 'std::basic_ifstream<char>::getline(std::__cxx11::string , int)'
for (string line; file.getline(line, 10); )
It is saying that it cannot find a “getline()” function that takes an array of ten strings and an integer.