Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Welcome back.
If we want to write different things through the screen, then something that we've already learned
is that we know that we could use the printed function with various different placeholders to put different
information to the screen.
For example, if we wanted to print integers through the screen, we could have used the percentage
D and if we wanted to print, I don't know, some floating point numbers, we could have used percentage
F or percentage L.F. for doubles.
We could easily work with different types of variables, and that's what pretty much I want I want you
to be familiar with when working with files.
All right.
So basically saying so far we've seen the functions that work only with characters, right?
These F get C and F Bootsie.
And now what I would like us to do is simply to extend these information.
So the question goes as follows.
What if we wanted to write the things we print on the screen to some file?
OK, just like we've done it with the printer function.
Now we are going to see some more general example.
OK, this one that I created for you, which will be done using the F print F function.
So how the F printer function looks like.
There you go.
Here is the signature F print f it gets a pointer to a file.
We already know what it is.
It gets some placeholders and associated parameters with this placeholders.
So for example, let me show you for example, so f print F F, B percentage D and num, which is of
type Int and now one, we will run it, we will try to save to write this information into my first
file 3.0.
So let's run this program and basically see what it will give us.
So where is it.
Where is it.
Where is it.
Come on.
Come on, come on.
Here it is.
So my file number three and there you go.
Five hundred and twelve.
So what does it teaches?
It teaches us that it can place different formations, different information in various formats, let's
say percentage and percentage d here will place like num multiplied by num.
OK, let's make num a little bit smaller.
Let's make it fif.
Let's see what we will receive now.
So there you go.
My first file, three and 525 in the space between them.
Pretty awesome, right.
Very simple usage, just like we've used previously, just like we've used the printed function to display
different information on the console application, just that now we specify where we want to redirect
the flow of information and it will be to F.P., which is a pointer to a file.
Also, one thing that I want to mention before we will finish up is that, of course, you can use higher
percentage F, right?
If you have, I don't know, float number two equals to nine point seven.
I don't know.
And so on.
Miskelly, there is no problem with that.
Right.
Let's run it and see what happens just to make sure that everything is working OK.
Oh, come here.
Come here.
Come on.
Come on.
OK, nothing is working.
OK, so there you go.
There is a problem.
What is the problem?
The problem is that we do not use here the proper values.
So let's use here instead of NAMS that are integers.
Let's use number two, which is of a floating point type to have everything associated with one another.
So yeah.
So there you go.
Five and nine point seven.
Awesome.
And last note about the F print F function.
Is that also.
No, for now it's not so important, but maybe in more advanced exercises we'll use it the f print function.
It also returns something OK.
It also returns something.
What does it return is the number of bytes it has successfully written.
OK, so just know that f print f function returns the number of bytes it has successfully written and
maybe even in these course I will show you some usages of this information.
Awesome.
And instead of dividing it into two separate videos, I decided also to include here the FS ganef and
it works in a very similar way, OK?
It reads information from the user, from the user, from a file and stores it inside different variables.
So, for example, that's just for simplicity.
OK, let's take this file.
My first file three.
Let's leave here, I don't know, one five one two that we had previously.
Let's save it, close it.
Close this one, two.
And now let's modify this program a little bit.
Let's go like reading mode, OK?
And let's create this enum.
Ain't no come on in now and we will read from these file.
What will we read?
We will read one placeholder percentage and where instead of print F, we will use F. Scott F..
OK, so these function works very similar.
It works like the F print F with the PHP pointer.
In this case, some placeholders.
And where should we store this information.
So now it says that at all.
OK, no problem.
Let's use here instead of Naameh we should use percentage now write the address of NUM.
So let's basically go like this and build and run it and let's see what happens.
So basically nothing will happen because we need to show that we have got something.
So let's print num from file equals to percentage there and we'll see if we've managed inside of these
program from this program to get the value inside of a file called my first file three.
That's sixty.
And store this value as an integer into variable num.
That's what all that's what we will see in line 24.
Let's run it.
Come on.
So there you go, numb from file equal to one 12 to 512.
So, yeah, this is this function, the second half.
And what I want to finish here is that you will understand also that.
The fiscal cliff and previously we had like f print F functions that we can also modify them, right?
We have like percentage D and we have like these.
Knowm So the F print F redirects this information into.
The file, right, pointed by F.P., but we could also do so.
By using what what's the index is very similar, there is the print syntax, right?
So print F percentage D and here specify num.
What will happen in this case will print the value of Naoum to the screen.
So here we will print it to the file and I want basically to put it in the console application.
So instead of F.P., what can we use.
Standard output.
Usted out.
Is it clear and the same goes for scaff, so instead of using Caniff, right, and putting it inside
numb, we can simply use it like this, Esterina.
Just getting the different.
Pointers stand there, are they input stand there with output and there you go.
Basically, it works the same as the printer and the scanner.
So very important, guys, for you to know that.
And yeah, so that's about it for this video.
And in the next last two functions for now that I'm going to discuss, we are going to talk about strings
and what functions, maybe more useful, at least a little bit more.
I don't know.
Some have their advantages, while others have their disadvantages and so on.
So we will see how we can work with strings, with two additional functions that will be called F puts
and F Gettis.
So thank you guys for watching.
My name is Vlad.
I hope you like this course and these videos.
Let me know what you think of it so far.
It's really important for me.
It gives me a lot of feedback and where I can improve May and also where I have done things right and
explaining to you in the best way I can.
So thank you so much for watching.
I'll see you in the next videos by.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.