I am reading a file that contain string and int data.
However, some strings have white spaces in between them yet are of one field. So when i read using getline and space delimiter, only a part of the field is read, this makes the next field to take incorrect data e.g taking the remaining half of the previous field, thus am not able to perform some manipulations. What do i do ? - I have tried soo many references but have found none addressing the problem.
File contain data like:
1 2 3 4 5 6
|
28th Nov 2012 United States 1:2 Colombia
29th Oct 2012 Japan 4:2 Saudi Arabia
14th Sept 2012 Yemen 3:1 Paraguay
|
So some string fields like
United States
yet the two should be read into a single variable. If i use getline without delimiter, it reads even into
1:
thus cant use the integer 1 for comparison and sorting. If i use a space delimiter with getline, only
United
goes into the right field, the string
States
goes into the int variable when read.
I have even tried to read the U.S string into a char array but the problem remains.