Introduction to File Data Type

Whatever programs we have done till now, those outputs were shown on screen. But that data was not stored in any secondary memory. This means those data were stored in primary memory, when we close the program then that data is permanently lost.

We need some secondary memory storage to store data which is available after closing the program also.

As the solution of this, C language provides FILE data type to store any data in a file. Which we can see after closing the program also. To point that file in the program, we have to make a pointer of FILE data type.

A FILE is actually a structure, the implementation code for it is hidden. It is said to be an opaque data type. And internally in the OS libraries, the FILE pointer is cast to the actual data type of the data structure that the OS will use to access data from a file. A lot of these details are system-specific though, so depending on the OS, the definition may differ.

 

Learning from this blog:

  1. Meaning of FILE data type.
  2. Why do we need a FILE data type?
  3. What is the actual data type of FILE data type?
  4. Where is the code of the FILE data type stored?
  5. What is the difference between normal data type and FILE data type?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments