Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Move to nth record of a file
I like to know how to move the file pointer(FILE *)
to the nth record or line of a file.
fseek() moves the file pointer to the number of bytes
from the file location.
I do not know how many bytes does a line(or record) has.
I read the file by fgets().
This helps in reading the file line by line.
Suppose I have moved the file pointer to 5th Line using fgets(),
now I want to move the file pointer to 2nd Line or to the 9th line
of the file.
How can I do this.
Thanks for your suggestions.
0 · ·