All language subtitles for 5. Creating a File and Reading from a File

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

What is going on, guys, in this video, we are going to take a quick look and to see how we can work

with opening files for a writing, reading and so on and so forth, and basically how the steps are

made behind the scenes.

So for that, I would like us to go to your project, click right, click on it and open folder in File

Explorer.

I would like us to take a look at how basically the project looks behind the scenes.

OK, so if you're using Visual Studio, that's how you approach it.

If you're using code blocks or clips, basically go to the folder containing your project.

OK, so this is the folder containing my project.

Here is the main dachsie file, which is this one.

And basically what I'm going to show you now is that I will create a new file just right in this folder,

in the folder of the project.

OK, so.

Let us start with a simple example.

So step one will remain the same, step two, we will create a new file.

So basically what what name should we give to these file?

Let's call it?

I don't know.

My first file dot dxp, which will represent here, you can see the file name and we will also do what

should we do?

Let's remove this complaint.

What should we do?

We should specify that we create these file for writing.

All right.

Then we will make sure that.

We are the opening process was successful, so let's just remove it, remove this one, so let's go

the other way around and ask if P equals two now if that's the case, right.

If that's the case, then the file opening file opening has failed.

And if that's the case, we would like to I don't know, let's say printf.

I don't know.

The file was not found, OK.

Or basically the the opening opening of the file has failed.

OK, so we treat this situation because we said that there may be times when we would wouldn't have

the option to open the file.

OK, so we would like to treat it.

Basically, you can print some message.

You can, I don't know, ask the user to specify the file name again and I don't know, exit the program

based on on the application you are going to develop and now we are going to use the L's else is related

to the fact when the returned result from F open was not equal to now.

Right.

So the file was successfully opened.

Let's bring some message, I don't know, the file is opened for writing.

All right.

Right.

And now what we are going to do is basically here once the file has been opened, let's take it under

some curly brackets.

So like this.

We will be able to write some code associated with the file we associated with the file, basically

write some information into this file and so on and so forth.

And the last step, right?

This was the fourth step.

Here it is.

And OK, and basically, let's just classify it here, step four, OK, which is optional, write some

code associated with the final step five F Glos F.P..

All right.

So what do you say?

Is it clear?

Let's just get it into the LS section so there will be no problems.

Awesome.

So what will happen now?

What will happen now when we will run these programs?

What will happen is basically we can see on the console application these massive message.

The file is open for writing that was done using these print command.

But behind the scenes what has happened is that if you take a look at this project, you will see that

my first file, which is the name of these file, was created inside of this project.

OK, so this is a file that was created inside of these project.

And if you would like to open it up, you can do so, but currently it's an empty file because we did

not put any information to this file.

OK, but one thing I want to show you is that from the program that you've written, you created it

totally.

Let's call it separate file.

Currently it's empty.

But here at step four, where you are going to write some code associated with this file, you will

be able to use various different functions to put some information to these file.

OK, and then the file is not going to be empty.

OK, so I hope that's clear so far.

And if you have any questions, feel free to ask them.

One last thing before we finish this video is that I would like to let you know if you, for example,

would like to specify a different path for your file.

OK, if you would not like to take these file into story, basically under I'm the director of the project

here, but rather you would like to story of this file.

I don't know, on your desktop.

So in this case, you just should specify the specific path that you are interested in.

So in my case, I would like to go with, I don't know, something like this.

See, OK, users, let's go to users Vladi desktop desk desktop and just specify the name.

I don't know my file one doctor.

So this will create a file that its name is my file one that 60 under this basically a specific path

that you've specified.

All right.

So now you know that you can write a file that did not exist, OK?

You created a file that did not exist so far.

And one thing that maybe it's very important also to mention is that what will happen if basically you

had some file?

OK, where is it?

Let me grab this file.

My first file.

Let's say this is some data on the file.

OK, so this file has some information.

We saved it.

Let's close it.

And now we can see that.

Here it is.

Here is our information.

But what will happen if we go back and basically try to run the program right now?

So what will happen?

What do you think?

So in this case, if we would like to run the program, OK, we will see that everything basically seems

to be working just fine.

But the main question here is about the file itself.

So let's take a look at it.

Where is it here?

Is it my first file?

The file is still there.

OK, but you can see that the file is empty once again.

So the thing that has happened is that the operating mode of w of writing works on a simple principle.

It says if the file does not exist, then created and if the file exists, then overwrite it.

So it doesn't care that there was a file with the same name and with some contents, it says, OK,

you want to create a new file and you are expecting that this operation may overwrite it.

There may be times when we would like to append something to the end of an existing file.

Right.

We will see basically additional examples about that.

But this note is very important for you to understand that using this writing operating mode will create

a new file if the file does not exist or it will overwrite a file if these file already exists under

this specific path.

And that you will specify here, OK.

So if you would like to create it under the desktop folder, then make sure that these file does not

exist there, otherwise it will be overwritten.

And any new information that you will specify in step for will be placed under these file overwriting

the previous information that was there.

OK, awesome.

Very good guys.

Very good.

We are going and doing great.

And now just to wrap things up and specify the second operating type of operation, which is reading,

let's go and say something like this.

Let's take this file that we have here.

Right?

Here it is.

Let's go like, hello, we have this message.

Let's close it.

And what I would like to do now is basically to read from these file.

So these program, whenever I will run it, it will basically use the PHP pointer to read information

from these file.

Although in this video, I'm not going to show you different functions that will grab the information

from this file and basically do with it whatever you like.

But basically, I'm just going to show you how this opening process will work behind the scenes and

basically just to let you know that everything was successful so was successful or not successful.

We'll see right now.

So let's go like this.

So we have this file right here, OK?

And we are going to run it and see if the opening process was successful.

So the file is open for writing.

Yeah, but we are going for reading.

Right.

So let's just update it.

So the file is ready for reading.

Let's run it and the file is opened for reading and we can start reading from these file.

But let's try opening some file that does not exist.

OK, for reading.

OK, we will try to open a file that does not exist.

So we can see here under these folder we have like a file, my first file that the extension.

So we can say for sure we don't have like something like this.

I don't know my second file that this file does not exist.

Right.

You can see that it does not exist under these directories.

So if we will try to run now this program, so what we will see that the opening of this file has failed.

So it makes sense, right, that the operating system could not manage to find my second file that under

this project and to open it up simply because it does not exist.

It's very different from the writing operating mode.

Right.

Because when you try to write a file that does not exist, it makes sense.

OK, if it doesn't exist, let's create the file and write it.

But if we want to read from some place in memory specified by the file name.

But this file does not exist, so it makes sense that the file opening will fail.

And in these type of cases, what you would like to do is basically also but that's not going to be

discussed here.

He's to try and understand what was the reason for these fail, whether it was because the child is

not that did not exist or basically something else.

But for now, it's just important for you to know that not every time this operation is going to be

successful.

So it's very important, especially for the first steps that you are taking with working with files

to right this condition and to make sure that the opening process has been successful.

Otherwise, there may be some problems with trying to access different information from an operation

like F Open that was not so successful.

So, yeah, this is it for this video.

I hope you got some information, some useful information from this one.

And in the next videos, we are going to proceed with the material and also talk about common input

and output functions.

And maybe I will also divide them to more smaller videos.

Each video will discuss different function.

I don't know.

Wait till the next video.

Until then, have a great day.

My name is Vlad.

This is Alphatech.

We are eLearning files and we are learning them great.

So until next time, bye bye.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.