You are not logged in.
In a file after finding a perticular heading(pattern), I have to skip 3 or 4 lines and then starts reading line by line.
How to skip lines in C file reading ?? Because fgets() reads lines sequentially.
To skip 3 lines, should I call fgets() 3 times without using return values ? is there any alternative way to skip 'n' lines in a file ?
Yes, something like that. That's the problem of lines, you don't know how long
they are, so you need to search for three '\n' chars one way or the other.
One thing to look out for with fgets() is how it handles lines longer than your
bufffer, if they're too long fgets() will return multiple times for one line.
When you need to deal with lines of arbitrary length, may I suggest using getline(), if
you're using glibc... That will dynamically allocate and resize your input buffer as large
as it needs to be to hold each line...