Hello Friends! In this article, we will know about data files in easy language and we always try to best content available for you. So let's start...
Data file: --
In C language, scanf and printf are used to read and write. But in this method if the data is more or if the data is needed later, then this method is not effective. That's why we need such an approach. So that the data can be stored on the disk and accessed from there To store the data, there is a file store.
The C language provides functions for various operations on the file. Which are the following.
(1) fopen():- To create new file or open old file.
(2) fclose ():- To close the open file.
(3) getc():- To read the character from the file.
(4) putc():- To write the character in the file
(5)fprintf():- To write set of data in file
(6)fscanf():- To read a set of data from the file.
(7)getw() :- To read integer from file.
(8) putw():- To write integer in the file.
You may also like: - What is Digital signature and its use?
Before saving the data in the file in the memory, the operating system has to tell about the file.
1) File name:- It has two parts
First is (1) name and (2) extraction
(2) Data structure:- File is to be saved in any format.
(3):- Purpose:- In this, it is seen that what we will do with the file, the following operations can be done on the file through the mode parameter.
Ex:-fp= fopen("name",mode);
File Access Mode
Mode’s who support by c language:-
r = for reading only.
w=only for writing.
a= only to append.
r+= for both read and write, but from the beginning.
As with w+=w, except for both read & write.
Like a+= a, except for both read and write.
Note:- If this article is useful for you then do comment below for the feedback .it will be very beneficial for us & also share it with your friends and classmates, or if you have any questions related to any topics and subjects, then you can do comment below or can write a mail to us. Thanks.