Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,330 --> 00:00:07,740
All righty, so I've organized a little bit the code that we had previously with all the steps and everything,
2
00:00:08,070 --> 00:00:16,770
and I just organized that a little bit more nice looking and ready for the usage and learning process
3
00:00:16,770 --> 00:00:18,800
of the functions that we are going to learn.
4
00:00:19,380 --> 00:00:22,610
And the first function is F get C.
5
00:00:23,540 --> 00:00:26,970
So these function works in the say in the following way.
6
00:00:27,180 --> 00:00:31,800
It receives just one argument, which is a pointer to a file.
7
00:00:31,850 --> 00:00:42,480
OK, probably is going to be like these F.P. a pointer to a file that has probably been opened for reading,
8
00:00:42,480 --> 00:00:43,710
just like we have here.
9
00:00:44,610 --> 00:00:53,130
And all these efforts, the function is going to do the F getz's basically an abbreviation of file get
10
00:00:53,250 --> 00:01:01,080
character, all it's going to do is to take one character after them, after the other.
11
00:01:01,110 --> 00:01:07,920
OK, one character, the second one, and so on and so forth from these file that has been opened using
12
00:01:07,920 --> 00:01:09,200
the pointer.
13
00:01:09,960 --> 00:01:14,070
So if we would like to demonstrate how it's going to look like.
14
00:01:14,070 --> 00:01:18,180
So let's create I don't know Char, let's create a variable char.
15
00:01:18,210 --> 00:01:25,410
Let's call each char mycar one and now we'll open up the file using the PHP pointer.
16
00:01:25,740 --> 00:01:29,300
We will make sure that the file was successfully opened.
17
00:01:29,310 --> 00:01:32,280
Otherwise there is no need to do anything.
18
00:01:32,940 --> 00:01:40,410
And now we are going to use like my char, my char one equals to f getsy.
19
00:01:40,450 --> 00:01:48,570
OK, you can see that the compiler, the compiler, our ID recognizes it and basically because we included
20
00:01:48,570 --> 00:01:50,160
the standard input output.
21
00:01:50,670 --> 00:01:59,400
So f get, see and hear, it specifies what type of argument it expects to receive.
22
00:01:59,430 --> 00:02:01,380
So a pointer to file.
23
00:02:01,380 --> 00:02:05,060
We know that FP is a pointer to file, so let's send their F.P..
24
00:02:05,730 --> 00:02:10,130
OK, and I'm talking about this file that I have right here.
25
00:02:10,140 --> 00:02:10,910
Where is it.
26
00:02:10,950 --> 00:02:11,560
Where is it.
27
00:02:11,580 --> 00:02:13,110
Here it is, my first file.
28
00:02:13,410 --> 00:02:16,500
It has the following text of hello.
29
00:02:16,920 --> 00:02:17,520
All right.
30
00:02:18,580 --> 00:02:21,710
Awesome, so let's close it, let's close it.
31
00:02:21,730 --> 00:02:22,900
Come on, come on, come on.
32
00:02:22,990 --> 00:02:31,600
OK, and now once we are going to read from these file, these character, we would like also to see
33
00:02:31,840 --> 00:02:33,270
what we've read.
34
00:02:33,310 --> 00:02:33,640
Right.
35
00:02:33,650 --> 00:02:39,330
So let's go like print F our standard print F to print the value to the screen.
36
00:02:39,340 --> 00:02:40,180
So let's go.
37
00:02:40,180 --> 00:02:51,160
Like the character, the character that was read is let's go percentage C and backslash and basically
38
00:02:51,160 --> 00:02:51,720
that's it.
39
00:02:51,730 --> 00:02:52,140
Right.
40
00:02:52,290 --> 00:02:54,490
And here we will specify my char one.
41
00:02:54,820 --> 00:02:56,020
My char one.
42
00:02:56,890 --> 00:03:01,900
Awesome, so let's try to build and run it and see what this program will give us.
43
00:03:02,590 --> 00:03:06,000
What do you expect to see guys think about it before you read it?
44
00:03:07,000 --> 00:03:10,330
You expect to see a capital H and there you go.
45
00:03:10,540 --> 00:03:13,500
The character that was read is Capital H.
46
00:03:14,080 --> 00:03:18,880
So we've read the first character from this file.
47
00:03:19,750 --> 00:03:24,640
And if we would like to read another character, let's simply copy this one.
48
00:03:24,740 --> 00:03:28,970
OK, so let's copy this one and based it right here.
49
00:03:29,000 --> 00:03:37,000
So my third one, the first let's make it the first character and the second character and basically
50
00:03:37,000 --> 00:03:39,640
build and run it once again and see what it gives us.
51
00:03:39,670 --> 00:03:46,110
So there you go, h e and basically we have the first character, the second character.
52
00:03:46,270 --> 00:03:53,800
And if you would have used maybe in your future exercises some loop here, then you will go and every
53
00:03:53,800 --> 00:04:01,990
time you will that every time that you will read a character from these file, you will also advance
54
00:04:01,990 --> 00:04:09,340
your PHP pointer to point to some relevant character that it has not read yet.
55
00:04:09,490 --> 00:04:10,450
OK, for example.
56
00:04:11,500 --> 00:04:19,270
So what I want you to know is that these pointer to file these file structure is very, very kind of
57
00:04:19,270 --> 00:04:19,980
smart.
58
00:04:19,990 --> 00:04:24,580
OK, it knows if it has read one character to move to the next one.
59
00:04:24,590 --> 00:04:33,640
And we will also see different functions that will allow us to move further and to move back on this
60
00:04:33,640 --> 00:04:34,800
stream of bytes.
61
00:04:34,810 --> 00:04:37,960
We said that file is a stream of bytes, right.
62
00:04:37,960 --> 00:04:42,730
So we can move from one side to another and read whatever we need.
63
00:04:43,610 --> 00:04:45,000
So I hope that's clear.
64
00:04:45,020 --> 00:04:50,950
So far, OK, guys, let me know if you have any questions regarding the F Getsy function.
65
00:04:51,770 --> 00:04:57,350
And before we will finish, we just we kind of important note.
66
00:04:57,860 --> 00:05:02,270
We remember that we talked about Ezzedine, right.
67
00:05:02,540 --> 00:05:08,960
Which is just the standard pointer to the keyboard standard or the important, just a pointer to the
68
00:05:08,960 --> 00:05:09,490
keyboard.
69
00:05:09,920 --> 00:05:17,960
And if we wanted to read information from the keyboard, we probably used these SDD pointer.
70
00:05:17,960 --> 00:05:18,380
Right.
71
00:05:19,130 --> 00:05:25,820
And we know that F Getsy reads a character from the pointer we supplied with.
72
00:05:25,830 --> 00:05:30,800
So in this case it was like a B, which is a pointer to a certain file.
73
00:05:31,010 --> 00:05:38,090
OK, but in our case, this is the case where we have these pointer to a file.
74
00:05:38,540 --> 00:05:48,650
But also we could have used the F Getsy function, this function and pass to it the Usted and as a pointer.
75
00:05:48,950 --> 00:05:51,410
So it will basically look like this.
76
00:05:51,890 --> 00:05:53,780
Let's get it here.
77
00:05:53,780 --> 00:05:59,750
So f getsy in here specify instead of the pointer, which is a pointer to this.
78
00:05:59,750 --> 00:06:02,660
My first file, the file.
79
00:06:03,350 --> 00:06:06,710
So FRSC and specify here SDD input.
80
00:06:07,010 --> 00:06:16,640
OK, so you see it recognizes also the screen and this way you will read one character from the keyboard.
81
00:06:16,910 --> 00:06:19,310
OK, so it will look something like this.
82
00:06:19,310 --> 00:06:20,330
Let's go like this.
83
00:06:20,600 --> 00:06:24,540
OK, so you see the console waits for your character.
84
00:06:24,560 --> 00:06:27,620
So let's go like OK, a presenter and then.
85
00:06:28,690 --> 00:06:37,630
The program continues, so FRSC is very general, and once you you do understand what is this Ezzedine
86
00:06:37,630 --> 00:06:39,190
standard input pointer?
87
00:06:39,520 --> 00:06:50,020
So we can say that F-16 is equivalent to get kind of equivalent to get chaar that you've used probably
88
00:06:50,020 --> 00:06:58,570
in one of your previous sections when you were study to read a character from the user or better say
89
00:06:58,690 --> 00:07:02,980
from the keyboard, from Ezzedine pointing to the keyboard.
90
00:07:04,160 --> 00:07:07,160
So, yeah, this is for these video guys.
91
00:07:07,220 --> 00:07:08,650
Thank you so much for watching.
92
00:07:08,660 --> 00:07:09,760
Keep on practicing.
93
00:07:09,770 --> 00:07:14,870
This is the first function related to working with textual files.
94
00:07:15,440 --> 00:07:21,560
Very important to understand that you will have some exercises, hopefully will add some good ones and
95
00:07:21,560 --> 00:07:23,330
until next time, have a great time.
96
00:07:23,660 --> 00:07:25,340
My name is Vlad Alphatech.
97
00:07:25,370 --> 00:07:26,210
I'll see you then.
9133
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.