We are having a look in the files in C++, which is somewhat advanced topic, and we deep dive into
it right now.
Let's go.
So you know, what is the necessity of using a file, right?
So we are actually interested in a storage medium for storing our data.
So it's like examples are like we have taxpayers where we stored our text data.
We have our document files, which we are using to create out, like using Microsoft word and stuff
like that.
We create work files or document files where we store both text, images and data like that and a lot
of other kinds of files out of there, right?
This presentation is an example for a file and Excel spreadsheets, which is also an example for file.
But in all where C++ was prevalent, there are mainly two types of files.
One must be files or text players, which we use to store that external data.
OK.
And another one was binary files, which we use to store like bytes of data.
It's also similar to text files, but the data format is stored at by another.
OK.
What is binary zeros and ones?
OK.
So in order to handle C++ files or files in C++, we can create files in C++.
We can all but the files.
We can write data and do it, and we can close that.
So that is the main process is right.
Like we are concerned while we are using files in C++.
So usually for creating files we use like our software such as not bad word bad data like that, right?
But in this case, we can programmatically create files using C++ programming language.
And in this topic, we are excitedly going to learn that.
So in order to learn that some key terms you have to understand.
One is file streams are file handling it, just like writing the file reading from the file or doing
operations in that file or creating file deleting file.
Everything comes under the file stream handling our file.
OK.
And in order to handle files in C++, we use the header file quite extreme.
OK.
And there are a lot of objects or classes inside the extreme darknet chatter file, which will consider
a lot of functions necessary for handling these files.
And we can learn about that.
So one of is offspring.
It's actually useful for writing two files.
So if I want to write that way, if you have the use object straw objects off all steam class and in
order to read the data from if I use, I have stream class.
And if you want to do both at the same time, you want to write the data to a file and read the data
from this file.
Then you use the class card.
Interesting.
OK.
Now these are the main things which we should do, or we should consider while creating a file with
C++.
It's not a simple thing.
We have several steps to do that.
OK?
First step is all putting it by before reading or writing to a file.
We need to open the van in that graph again.
You set it up.
It's very easy to open up, right?
We are seeing the file as I visualized form.
So you are you can just double click on the icon of that file, then the fly at all times and you can
see the file.
That's very straightforward and simple, but we are doing this programmatically meaning to open that
file programmatically.
And in order to do that, we have several programmatic courts.
OK.
So we can go to the steps first and then the detailed steps later.
So first step is opening your file, then you can read and write to.
OK, after that file is all funding the program, you can read from the file or right through that file.
Then you need to close the file.
That's the final steps.
So these are the important steps which we need to do while we have to create that fire.
So now let's see each step in the update.
So opening your file?
Right?
I have already discussed that either let off steam or steam object can be used to open a file for writing.
OK.
And if stream object is used to open a file for reading purposes, if steam can only open the file for
reading.
But if you want to open the file for writing.
Use both of Timor F Street now, how you get one of the file that is used to buy a function, call all.
OK.
And it's a member of extreme, extreme and off stream objects.
OK.
This function is I like get we are getting this function from the extreme garbage header file.
And how are you going to do that?
This indexes void or.
Then on the bracket, you have to specify the file name, then how you want to burn that file.
So this is debris dot symbol, right?
Or Pan Maude Maude.
This one is called file or binary, more so we will be discussing that right now in the next slide.
So how you can use this iOS Dot Dot or by more more, then that's actually very useful for you to know
how what are the different ways you can find and this opening more chapter opening your file in different
manners?
OK, see here to have that march off opening.
So again, if you are opening your file in iOS app more, then that discard app and more so if you open
a file, walked all things you right into that fight.
It will be appended to the end of the file.
See, the other line is you will not be able to see the file like in a graphical user interface.
So why do you need to do is like you need to specify how you want to use the file in your program.
So in order for that, you have different types of modes of operating a file.
And those are specified all here.
And if it is an app and more water things you write into that file, it will be appended to the end
of the event in order to help you understand this topic.
I'm actually going to flag different find for getting the pen.
And suppose you have a file and daddy, you have this particular thing written.
Welcome to my new file.
This was the content of the fight, and if I'm opening the fight in a pen more, then what are things
you put into the fire?
Later, it will be come after that last portion of the fair, which means after this new.
So if I'm adding a few more lines, why this is getting added at the end, because you have opened the
firing at Benmore, then you have 80 more, which is actually putting a file for moving the read or
write and burn for the end of the file.
So this is all just similar to a more like you can do both.
You can read from the end or write end.
And if you want to just open the file for a file for reading reading only, then you can use Enameled.
And if you want to open a file for writing early, then you can use out more.
And if the fire is already there and you want to believe that file with that very same name, right?
But you want to believe that file and create a new file with that same name, then you have to use more.
So suppose this is my file called.
My final.
Not ESD.
This is my file, and this is my file with this gunman.
And I want to be need all the amendments inside this my pilot and add everything from the beginning.
Then I will be using try and get more.