Guest User

Untitled

a guest
Oct 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. int main(void)
  5. {
  6.     printf("Enter the filename: ");
  7.     char filename[30];
  8.     scanf("%s",filename);
  9.     printf("Trying to read %s \n",filename);
  10.     char c = '\n';
  11.     int i = 1;
  12.     FILE * f = fopen(filename,"r");
  13.     while (!feof(f))
  14.     {
  15.           if (c == '\n')
  16.              printf("",i++);
  17.           c = fgetc(f);
  18.           putchar(c);
  19.     }
  20.     fclose(f);
  21.     getch();
  22.     return 0;
  23. }
Add Comment
Please, Sign In to add comment