Okay so now you have checked if the file exists or not.
Our next step is to handle if the file does not exist so we can see that if Y and insists equals equals
true false.
Which means that file does not exist.
We can create a new error.
I'm going to call on date.
Uh because to because 2 is not new.
And then I'm going to give you my custom string which is fine to log on and then I'm going to turn this
edit if everything is perfect.
We proceed for the K our next step would be to read the final contents.
We should read by itself this file into our program.
Let's create a new function which will read the file contents.
I'm going to call this function as read contents or read file contents.
So this is going to receive a file name which would be a string
and then it's going to return to a world.
The first would be an array of byte which would contain all the final contents here and then into return
and error.
If there is some problem.
So now you have a function.
Then it's on the two.
Okay let's leave right here then do this keep.
If the file like this we can call this function here we find content and then we can give the file.
Let's move over here.
Our next step here is to open this finding our program so we can use this by using all our stock open
function which will open this file which is failed to pick for us to open and then they need to provide
the file name which would be this.
And then we will store the file object and had it here so we can say if uh is not equal to men.
And then they want to open the file
and then we have simply the two main bytes and then the other which is the actual letter.
So once we have a proper functioning file object we can use this file object to read the file before
we proceed for that let's just differ this statement in the laws so we get a proper lawyer for this
file object.
Okay.
The next thing we need to do is we need to check out what's the size of the file and what is the name
of the file so we can do this by using file a dot stat.
And this will be done the final step so you check the documentation.
It says that it returns file object and error so fine object we can just call it stats and then it.
Now we have stats do you want to do is you want to find out the size of this file in bytes so we can
use this by calling this object starts and then the size and this and then in 64 number which would
be the number of bytes this file complaints.
So I'm going to call it fine.
Sighs
because two states so now you have a file size here.
The next step is to simply print out this file too so we know how big is the file of why then means
signs and bytes.
This is just for our understanding.
Okay.
So the next step is to create a buffer.
So I will do this next lecture.