traversing files and skipping lines
When you read file in C and move to next line and so on. This seems you have to access file top to bottom sequentially without skipping lines.
I need a way to read very 5th line or something similar to it. I am just concerned with data that is present very 5th line. So if I start with line 1, then next line I want is line 6 and so on.
Would I be able to achieve this kind of file reading?
jobs
Junior Poster in Training
58 posts since Jan 2007
Reputation Points: 10
Solved Threads: 0
When you read file in C and move to next line and so on. This seems you have to access file top to bottom sequentially without skipping lines.
I need a way to read very 5th line or something similar to it. I am just concerned with data that is present very 5th line. So if I start with line 1, then next line I want is line 6 and so on.
Would I be able to achieve this kind of file reading?
Read 4 lines, process the next. Read 4 more, process next.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
The modulus operator is the key.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439