Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- main ()
- {
- FILE *fileToCount;
- fileToCount = fopen("testfile.txt", "r");
- int lnNum;
- scanf("%d", &lnNum);
- int il, c;
- il = 1;
- while ((c = fgetc(fileToCount)) != EOF)
- {
- if (c == '\n')
- {
- il++;
- }
- else if (il == lnNum)
- {
- printf("%c", c);
- }
- }
- printf("\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement