How do you move around a text file in C?
Hello! I'm new to C and i'm trying to figure out how to move down a text file and print out only certain lines.
I know that fgets reads one line from a file but how do you skip 4 lines and then print out the 5th line?
Do i use a while loop?
i would just like to know what allows you to skip lines in a text file.
int a = 0;
if ((ptr = fopen("input.txt","r") == NULL)
printf("Cannot open file");
while (a < 5)
....don't know what to put here to skip these lines....
if (fgets(word,20,ptr) != NULL) ......printing the 5th line