Trouble using getline() and storing input till later use.

I am writing a class that uses an input facilitator function that will be used in another program to read from a .txt file. The .txt file reads as string (space) string (tab) string (tab) int (space) int (space) int. The issue I am having is that the string separated by the tabs is sometimes two strings, such as "Rhode Island" and I need to be able to read the lines and not have it read (tab) Rhode (tab) Island etc. Below is what I have currently for my input function that uses '\t' as the delimiter:

void State::input(istream& in) {
string info;
getline(in, info, '\t');
}
istream& operator >> (istream& in, State& st) {
st.input(in);
return in;
}

The issue I am having is how exactly I can use this in coordination with this code from the second program:

State state;
while (fin >> state)
{
state.display(cout);
cout << endl;
}

After this call the second program outputs the information but uses my default constructor and none of the information from the .txt file.

Any help appreciated, thanks.

Topic archived. No new replies allowed.