Sunday 11 January 2009

File handling questions in c programming with solution.



(1)What will happen if you execute following program?



#include

int main(){

    unsigned char c;

    FILE *fp;

    fp=fopen("test.text","r");

    while((c=fgetc(fp))!=EOF)

         printf("%c",c);

    fclose(fp);

    return 0;

}



//test.txt

I am reading file handling in
cquestionbank.blogspot.com



Output: 

It will print the content of file
text.txt but it will enter in

No comments:

Post a Comment