I have a text file like this
Path
827 196
847 195
868 194
889 193
909 191
929 191
951 189
971 186
991 185
1012 185
Path
918 221
927 241
931 261
931 281
930 301
931 321
927 341
923 361
921 382
I am reading every line in a text file using getline function , i want to parse the 2 numbers in a single line into two different integer variables .The code i have so far is .
int main()
{
vector<string> text_file;
int no_of_paths=0;
ifstream ifs( "ges_t.txt" );
string temp;
while( getline( ifs, temp ) )
{
if (temp2.compare("path") != 0)
{
//Strip temp string and separate the values into integers here.
}
}
}
1 Answer