Example of File Pointer
C
// C Program to demonstrate the file pointer #include <stdio.h> int main() { // declaring file pointer FILE * fptr; // trying to get the size of FILE datatype. printf ( "Size of FILE Structure: %d bytes" , sizeof ( FILE )); return 0; } |
Output
Size of FILE Structure: 216 bytes
C File Pointer
A file pointer is a variable that is used to refer to an opened file in a C program. The file pointer is actually a structure that stores the file data such as the file name, its location, mode, and the current position in the file. It is used in almost all the file operations in C such as opening, closing, reading, writing, etc.