C/What is FILE in C Language?
Expert: Prince M. Premnath - 6/19/2009
Questionhello,
respected sir,
to make a file in c language we write, FILE f1; question is, why file extension is in capital letter?
AnswerHi Dear hiren jobanputra !
First of all let me confirm you that FILE is not a key word , perhaps its a user defined data type defined in stdio.h , presenting you the following code to justify my answer !
typedef struct {
int level; /* fill/empty level of buffer */
unsigned flags; /* File status flags */
char fd; /* File descriptor */
unsigned char hold; /* Ungetc char if no buffer */
int bsize; /* Buffer size */
unsigned char *buffer; /* Data transfer buffer */
unsigned char *curp; /* Current active pointer */
unsigned istemp; /* Temporary file indicator */
short token; /* Used for validity checking */
} FILE;
( Note : Code Excerpt copied from stdio.h )
While dealing with files in C programming , sure you might have came across this codes.
FILE * fp;
fp is a file pointer of type FILE , this file pointer is just to store the composite information about a file subject to manipulation , while opening a file using fopen(), this function will return a pointer of type FILE ,ie fp holds all the information about the file , this informations are vitally used in all operation regarding file processing , in C programming all the files will be given a unique handle ( say file pointer ) using this handle we can perform manipulations over a file
since you are a beginner definition regarding the FILE structure members are out of scope , if you wish to have please post me a follow up !
Thanks and Regards !
Prince M. Premnath