#include <iostream>
#include <sstream>
#include <string>

int main ()
{
    // 1. read each line from the file into a string with std::getline()
    // http://w...content-available-to-author-only...s.com/reference/string/string/getline/

    // as an wexample, say, a line read from the file is:
    std::string line = "x1888.88 14.56 123456789 xxx yyy zzz" ;

    // 2. create an input string stream which reads from the line
    std::istringstream stm(line) ;

    // 3. read the fields from the input string stream
    char junk ;
    char type ;
    float hours ;
    double salary ;
    long id ;
    std::string fname ;
    std::string mname ;
    std::string lname ;

    if( stm >> junk >> type >> hours >> salary >> id >> fname >> mname >> lname )
    {
        std::cout << "junk (to be thrown away): " << junk << '\n'
                   << "type: " << type << '\n'
                   << "hours: " << hours << '\n'
                   << "salary: " << salary << '\n'
                   << "id: " << id << '\n'
                   << "fname: " << fname << '\n'
                   << "mname: " << mname << '\n'
                   << "lname: " << lname << '\n' ;
        // ...
    }
    else
    {
        // badly formed line
    }
}
