no matching function for call to 'std::basic_ifstream<char,std::char_traits<char> > :: get(char[15])'
I've looked around and I can't figure out what's going on. My professor used the same example in class, but it still doesn't work. Can anyone help? Thanks ahead of time.
You can either use getline to get a single line at a time, or fin >> temp to get a single word at a time. If you want to read a "name" each time, C++ don't know what a "name" is, so you have to implement it using the basic functions.
I don't know exactly what you want though. Does the line contain more after "Tom Wilson", since you want it to stop at that point? In this case, if you always have exactly one first and one last name, you could do something like this:
1 2
string first, last;
fin >> first >> last;
However, if you want to support more advanced stuff like optional middle names, you can't expect a single standard function to extract one "name" and stop. You have to do some programming yourself. The easiest way is probably to have the file format as simple as possible, like one name on each line.