reading a character from file using fgetc

 #include <stdio.h>


int main(){
FILE * fptr;
char c;
fptr=fopen("fgetcsample.txt","r");


printf("%c\n",fgetc(fptr));
printf("%c\n",fgetc(fptr));
printf("%c\n",fgetc(fptr));
printf("%c\n",fgetc(fptr));
 return 0;
 
}

Comments

Popular posts from this blog

snake game Version-2 (using random number)

allocating dynamic memory using calloc

store a table in dynamic array and then change the size of array dynamically to store more numbers