Read a Text File Character by Character and displays these contents on the screen - C String

C examples for String:char array

Description

Read a Text File Character by Character and displays these contents on the screen

Demo Code

#include <stdio.h>

int main(){/* www  . j  a v  a2s .co m*/
     int num;
     FILE *fptr;
     fptr = fopen("test.txt", "r");
     num = fgetc(fptr);
    
     while(num != EOF) {
          putchar(num);
          num = fgetc(fptr);
     }
    
     fclose(fptr);
     return(0);
}

Related Tutorials