My text file looks like this:
987 10.50 N 50
383 9.500 N 20
224 12.00 N 40
I want to read only the second column of data. How w
You'll need to read all the data, and discard the unneeded fields (i.e. "columns"). Format strings containing %*d are doing that.
In C, it could be something like (assuming f is a FILE* handle)
while (!feof(f)) {
int n=0; double x=0.0; char c[4]; int p=0;
if (fscanf(f, " %*d %f %*[A-Z] %*d", &x) < 1)
break;
do_something(x);
}
PS. Thanks to Jerry Coffin for his comment