when a pointer is pointing to the address of a file than it is called as a file pointer. for example: FILE *fp; here in above statement we are declaring a file pointer. there are many modes of opening a file.they are read ,write,append .. they are as follows.. fp=fopen("filename.c",'r'); above statement is opening a file in read mode..
File pointer is the pointer which holds the address of the file which is opened either in read or write or append or binary modes(r,w,a,r+,w+,a+,b).
This is the declaration of the file pointer.
Opening of the file is done by any one of the following.
fp = fopen("filename.txt","r"); or fp = fopen("filename.TXT","w"); or fp = fopen("filename.DAT","a"); or fp = fopen("filename","r+"); or fp = fopen("filename.txt","w+"); or fp = fopen("filename.txt","a+"); or fp = fopen("filename.txt","b");
When fopen opens the file successfully, fp holds the address of the first character in the file.
We can read or write into the file using the functions like fread() or fwrite().
After all operations, we have to close the file using fclose(fp);