You are here:

C/What is FILE in C Language?

Advertisement


Question
hello,
respected sir,
 to make a file in c  language we write, FILE f1; question is, why file extension is in capital letter?

Answer
Hi 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  

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Prince M. Premnath

Expertise


I'm sure that I can solve any doubts in Turbo C ,Graphics Programing ,Mouse, Hardware Programming ,File System ,Interrupts, BIOS handling , TSR Programming , General Concepts in C Language, handling inline Assembly statements

Experience

Research over 6+ Years

Organizations
CG-VAK Softwares and Exports Limited

Education/Credentials
Masters in Computer Applications

©2012 About.com, a part of The New York Times Company. All rights reserved.