Category ID Description
1 Pay Check
2 Groceries
3 Utilities
14 Rent
25 Mortgage
6 Travel
7 Refund
8 Restaurant
9 College Fund
10 Transfer From Savings
and place the category id in one variable, and the entire description in another? Preferably, I'd like to have a class whose attributes are categoryID and Description, and set their values according to the file.
One way would be to operator<< in the first number of every line into an int, and then std::getline() the rest of the line. operator<<() is delimited by spaces, but std::getline() can be delimited by whatever you want, default delimiter is newline '\n'. http://en.cppreference.com/w/cpp/string/basic_string/getline
If you know there will always be a space between the number and the start of description, you can just do my_string.erase(0, 1);
Otherwise, you could either call erase repeatedly until the first character isn't whitespace, or you could do something more sophisticated by combining std::erase with std::find_if.