2010/08/01,00:00:00.196558, 19.3757,-100.9560, 16.4, 9
2010/08/01,00:00:00.057130, 19.3016,-101.0137, 17.3, 9
2010/08/01,00:00:02.169931, 13.3377, -87.6697, 26.0, 5
2010/08/01,00:00:02.979120, 6.9769, 107.8329, 6.2, 5
2010/08/01,00:00:04.244443, 15.7306, 104.0247, 16.3, 8
2010/08/01,00:00:05.089689, 48.9474,-103.4495, 25.6, 8
and would like for my fscanf function:
k=0; while(fscanf(in,"%d/%d/%d,%d:%d:%f, %lf, %lf, %lf, %d", &YYYY[k], &DD[k], &MM[k], &s1[k], &s2[k], &s3[k], &lat[k], &lon[k], &DE[k], &sense[k]) != EOF) k++; fclose(in);
to only scan for the first say 50k lines. I'm quite naive when it comes to knowing the specifics of code, I just kind of replicate what I did in undergrad without really paying attention to why. It would be nice to learn one of these days. Anyways, it's the EOF portion that's messing with me. My input file is 313k + lines. I just want the first 50k lines fscanf-ed searched for criteria (lat/lon domain (4th and 3rd from right columns)), and then printed to an output file. Once I did the first 50k lines, I want to move to the next 50k lines (50,001 - 100,000), append to the output file, and repeat until EOF.


Sign In
Create Account


Back to top









