state_info si;
constint state_col = 5, cap_col = 20, pop_col = 40;
size_t end = line.find_last_not_of(' ', cap_col - 1);
// Back track from the first character of the capital column until we find a character
// that is not whitespace, this will give you the end character of your state column.
si.state = line.substr(state_col, end - state_col + 1); // Args for substr are the starting value,
// and # of characters to copy, so you need to minus the start from the end in the 2nd argument.
si.state will now contain the full string of your state column, rejoice! I'll leave you to figure out the rest.
Regarding the population value, see here:-
http://stackoverflow.com/questions/6373513/currency-formatting-with-c