Hello, in this video, we are going to look at reading a file using the read file function. So this is a very simple way of reading the file. So what this does a gets the contents of the file, which is our current file dot txt here says hello world. I am awesome. And it literally is just in the same directory. If you had in a different directory, maybe you had a text files, and then in there was the form, you just put the actual directory path, and we actually go to access and what it does, it gets it puts it to the output buffer.
And we can actually use that however we want. This is just a very basic way of doing it. Over the next few videos, we're going to look at all the different ways of handling files should go back to here. So to do this, all we do is read file. And then we specify the path of the file because it's in the same place we literally put folder TFC and you can read Other than dot txt as well. And I'm gonna assign this to a variable, someone say, file equals this.
And if we was to run it, as you can imagine nothing to do file equal read, okay, yeah, that's fine. Or we could directly go and do echo like this. So we could just echo it out. And we get this will just be a ASCII character. So we can, you know, ignore that. And or you can do it this way.
You can manipulate that however you want. So, that end local saying is this, some part of ASCII. So and as you can imagine, that's not really desirable. Plus, there's not really any formatting to it as well. You would have to handle that yourself even by pouring some sort No brake line tags in here, or put in you know, reading it manually line by line and we're going to cover all of this in more depth over the next few videos. So that's it for a simple way of reading a file.
If you have any questions, feel free to drop me a message and as usual, I look forward to seeing you in the next video.