File read using fgetc ()

 #include<stdio.h>


int main(){

    FILE *ptr;

    char c;

    ptr = fopen("getcdemo.txt", "r");

    c = fgetc(ptr);

    while(c!=EOF){

        printf("%c", c);

        c = fgetc(ptr);

    }

    return 0;

}

Comments

Popular posts from this blog

Snake game.c

Type declaration

Array with function