Question: How do you skip over columns of data when reading a file in C++? Below is a snippet of the data I'm reading, which is

How do you skip over columns of data when reading a file in C++?

Below is a snippet of the data I'm reading, which is from a csv.

WAST,DP,Dta,Dts,EV,QFE,QFF,QNH,RF,RH,S,SR,ST1,ST2,ST3,ST4,Sx,T

31/03/2016 9:00,14.6,175,17,0,1013.4,1016.9,1017,0,68.2,6,512,22.7,24.1,25.5,26.1,8,20.74

31/03/2016 9:10,14.6,194,22,0.1,1013.4,1016.9,1017,0,67.2,5,565,22.7,24.1,25.5,26.1,8,20.97

I need to ignore the header row, which I think I've done correctly. I now need to read data only from column labelled S. I've tried using infile.ignore to skip over the data 9 times, since S is the 10th data column, but it doesn't seem to be working.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!