c - what is the address pointed by file pointer? -
#include <stdio.h> #include <stdlib.h> int main() { file *file1; char c; file1=fopen("find1.txt","r"); if(file1==null) { printf("\n file doesnt exist\n"); exit(1); } else { while(1) { c=fgetc(file1); if(feof(file1)) { break; } putc(c,stdout); } } }
what think how code work fgetc() take character file pointed filepointer , put character in "c".next time takes next character file , put in "c". filepointer increment , point next character?or handeled in other way ?
the file1
pointer not incremented. file
object points contain (among other things) pointer current stream position, , that updated read or write file.
Comments
Post a Comment