Hello guys.
Welcome back to another session all for us programming for beginners and indecision.
You're going to learn about a file handling in C language.
So let's get started.
So what does a fine fine is a collection of bytes that is stored on secondary storage devices like this.
There are two types of files in a system.
The first one is strictly files.
The second one is by notifies.
OK so a text finds contains ascii codes of the alphabet and symbols.
It's nothing but a file which we use on a day to day basis the normal text file that normally got the
extra file.
OK so the second one is a binary files are mostly that not been files in your computer.
It contains a collection of by zeros and ones binary files are compiled versions of X Files.
Okay so in this tutorial mostly I'm going to color on this topic X maybe is more important content as
part of fine handling in C.
OK what are the advantages of files when a program is terminated to enter data is lost.
Storing in a file will present your data even if the program terminates.
The second advantages if you have to enter a huge number of data it will take a lot of time to enter
them all back.
If you have a fine containing all the data you can easily use them and access and access the contents
of the file.
The third advantages you can easily move your data out from one country to another without any changes.
Nobody's like me.
I know plenty of options to copy your data from one mission to another.
You have been dry.
We have all of these really easily.
You can just copy that down just read using whatever you want.
OK.
He's also the advantage of using fire.
OK.
So in this tutorial we're going to do because of audio files operations.
There are four basic operations that can be performed at any fire since he programming language.
They are opening or creating a fire.
Reading a file writing a fire closing a file so very we're going to discuss about opening your file.
I reading a file or writing a file causing a file so that's it.
Okay so these are the four things which you are going to discuss in this tutorial.
Hi guys.
No we will learn how to declare a five point turn and the hole to specify the mode for files.
Okay.
Working with files we need to declare a pointer of a fight in this format.
This declaration is needed for communication between the fight and the program.
Okay so we just specify a file is not it should be in caps then space as Jewish then the by Internet.
So here I mentioned as FP 1 it can be FP to what effectively whatever.
Okay so no.
After this after this declaration we have to specify the more innovation world you want to open the
file.
It is in the lead mode or right more and more.
Okay there's a basic syntax so with the help of this important function we can open a file in the lead
write it up and more.
Okay.
So here they'll be parameters file open in this parameter we can parse a text file which you want to
open.
So for example if it isn't the same but then the program resides in guess.
If the text file is in a different body then you are to specify the battle here on the more.
Okay so more will go to this because I bought three more here in AR for reading the fight and W for
fighting the fight and effort opening the data okay on an existing fine.
Okay so please note when we are trying to open a file an art form.
If it is not available the file is not available.
Edit It's not okay whereas in w more if you're specific if you have specified this apple for F open
function with the W more if the file doesn't exist it creates a fine.
Okay it case dates or whatever but the thing is all over it all the data on the previous data.
Okay.
For example I have 10 words in the existing file and if I'm opening the file with W mode it's override
although it will delete all all the contents of the new contents which you're adding it'll be safe.
Okay.
I've been knowing this guess what happens is like suppose like if I don't want to delete any of my all
data I want to retain more data on top of it I want to and better then you can use this e append more.
Okay so 3 most will discuss with the programs on the line.
So R W A.
Okay so this syntax is mandatory and the syntax is mentally but while handling C program.
So let's just want to give a high level idea about this bill functions because we're going to use this
in the program assessment.
So as we are going to use f open function to f open function is used to open a file to perform operations
that designating writing are happening and F close functionality we're going to use a disk function
and we use to close the file and get as is an invalid function which is used to read the string of characters
from keyboard input.
Okay.
And the fourth function which you are going to use in that program is f get C the function f gets is
used to read the character from the file.
So this are the Ford in Bill functions which you are going to use in the file handling program.
Okay.
Please note when you're doing it when you're writing a program for file handling the first step should
be if we open the second.
And therefore when you specify whether you want or open the file in lead format or write format or append
formidable often then you look we'll perform some operations thought at the last you should use this
f close function not to close off.
So there'll be three steps and open open the file and read more write more that happened.
Second step you'll do your operations.
What do you want to do it.
And the third step will be you had to close you have to use f close function to close a fine.
Okay so let's get the program now.