So I'm having trouble storing the information after parsing a text-file. The text file has something like this inside it
1234 Main St; Oakland; CA; USA
2134 1st St; San Fransico; CA; USA
etc. etc.
I currently have these variables that I'm going to use to store the address's information
vector <string> addressInfo;
vector <string> street;
vector <string> city;
vector <string> state;
vector <string> country;
I'm also currently able to get the program to remove the ";" from the file and store all the information into a single vector using getline
while(read == true)
{
getline(in, line, ';');
if (in.fail())
{
read = false;
}
else
{
addressInfo.push_back(line);
}
}
When I do a for-loop to output what is inside the addressInfo vector, I get
1234 Main St
Oakland
CA
USA
etc. etc.
I know that I might have to use stringstream but I don't know how to store each line from the vector into the different variables.