Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,210 --> 00:00:01,380
What is going on, guys?
2
00:00:01,410 --> 00:00:07,580
And welcome to this amazing section about files in our programming language.
3
00:00:08,190 --> 00:00:17,280
So what I want us to understand before we dive into files is basically that using files as part of your
4
00:00:17,280 --> 00:00:25,340
development process is pretty much necessary in most of the things that you are going to work with.
5
00:00:25,350 --> 00:00:33,480
You're probably going to work with files and whether these will be done using your programming language,
6
00:00:33,480 --> 00:00:36,460
for example, C, C++ or even Python.
7
00:00:36,690 --> 00:00:43,320
So basically by learning the concepts of using files, even here in these course, you will be able
8
00:00:43,320 --> 00:00:44,210
to implement them.
9
00:00:45,060 --> 00:00:49,950
This knowledge also in other spheres, in other programming languages as well.
10
00:00:50,160 --> 00:00:54,940
So pay close attention because that's a very important topic.
11
00:00:55,890 --> 00:01:02,980
But before we move on and understand how the files work, I would like us to give it a little time,
12
00:01:03,010 --> 00:01:07,800
about two or three minutes, and to talk about what have we learned so far.
13
00:01:08,700 --> 00:01:15,400
So up until now, we've learned how to create different variables, how to use different loops.
14
00:01:15,750 --> 00:01:19,170
We've also talked about functions and so on and so forth.
15
00:01:19,170 --> 00:01:19,520
Right.
16
00:01:20,190 --> 00:01:26,520
And in all of these steps or sections, we could have seen our program being run.
17
00:01:26,520 --> 00:01:34,430
But once it was completed, once the execution was finished, the program finished its execution process.
18
00:01:34,770 --> 00:01:43,020
We actually didn't get any chance to see something written anywhere except just this nice black console
19
00:01:43,020 --> 00:01:43,650
that we had.
20
00:01:43,650 --> 00:01:43,920
Right.
21
00:01:43,920 --> 00:01:44,490
Where is it?
22
00:01:44,910 --> 00:01:52,590
This black console and least console application is nice, but let me show you, for example, so here
23
00:01:52,590 --> 00:01:55,100
were our results so far.
24
00:01:55,980 --> 00:02:04,260
So up to this point, the only thing we knew how to do regarding printing the output somewhere, it
25
00:02:04,260 --> 00:02:08,670
was just displaying the output here on these nice little screen.
26
00:02:10,400 --> 00:02:18,350
But suppose that, for example, you have to write a program that prints all the numbers from one up
27
00:02:18,350 --> 00:02:24,860
to 50 and next to each number, you have to print the square of this particular number.
28
00:02:25,310 --> 00:02:27,290
So how would you do it so far?
29
00:02:27,290 --> 00:02:27,600
Right.
30
00:02:27,740 --> 00:02:30,350
We could have done it, let's say something like this.
31
00:02:30,350 --> 00:02:35,120
So let's say I and then specify for I equals to one.
32
00:02:35,120 --> 00:02:37,480
As long as I'm less than 50.
33
00:02:37,490 --> 00:02:41,420
Let's go with C++ and just use something like this.
34
00:02:41,420 --> 00:02:51,170
So print half the value of the number I and the value of the number multiplied by itself.
35
00:02:51,170 --> 00:02:53,630
So I and I multiplied by I.
36
00:02:53,870 --> 00:03:00,770
OK, so in this case, if we would run it, basically everything would be printed to the screen and
37
00:03:00,770 --> 00:03:03,020
you could see something like this.
38
00:03:03,290 --> 00:03:03,630
Right.
39
00:03:03,650 --> 00:03:08,740
So two multiplied by two is four, three is nine and so on and so forth.
40
00:03:09,070 --> 00:03:09,440
Right.
41
00:03:10,370 --> 00:03:17,540
But the main question here is, let's say that sometime in the future, you would like to see these
42
00:03:17,540 --> 00:03:24,290
results that you've calculated, although here is a very a very simple example.
43
00:03:24,290 --> 00:03:29,000
But let's say that later on you would like to see these results once again.
44
00:03:29,220 --> 00:03:36,440
OK, I don't know, maybe maybe think of it as a situation where you are going to write some amazing
45
00:03:36,440 --> 00:03:42,230
program that does a lot of research for some topic, I don't know, biology or something like that.
46
00:03:42,660 --> 00:03:47,600
And then your program should calculate the result and come to some conclusions.
47
00:03:48,000 --> 00:03:55,400
For example, let's say that a program can tell you or say your program will predict what will be the
48
00:03:55,400 --> 00:04:01,430
weather outside from this day up to, let's say, 7000 years from now.
49
00:04:01,770 --> 00:04:08,390
OK, pretty cool program, but you've written this program, you run it, you wait a couple of hours
50
00:04:08,390 --> 00:04:10,010
to get the results done right.
51
00:04:10,010 --> 00:04:17,600
Because your program is not just two lines and then the results are being printed to the screen, just
52
00:04:17,600 --> 00:04:18,890
like we've done it right here.
53
00:04:19,640 --> 00:04:23,300
So you see the result and then you come the next day.
54
00:04:23,300 --> 00:04:31,310
You recall that there is a vacation that you are planning to do next week, but you don't know what
55
00:04:31,310 --> 00:04:32,320
will be the weather.
56
00:04:32,450 --> 00:04:39,680
So what do you have to do is basically run this program once again, wait for the results and then compare
57
00:04:39,680 --> 00:04:40,940
it again.
58
00:04:40,940 --> 00:04:44,270
But the results are basically expected to be the same.
59
00:04:44,280 --> 00:04:46,160
So it would have been.
60
00:04:47,150 --> 00:04:53,780
Much better if we could take all of these results printed to these council application and basically
61
00:04:53,780 --> 00:05:01,820
to redirect this output stream, let's call it for now, like output stream of data being moved to the
62
00:05:01,820 --> 00:05:04,370
council application instead of making this process.
63
00:05:04,700 --> 00:05:13,010
We what we would like to do is to take all of these data and to put it in some file that will be stored
64
00:05:13,130 --> 00:05:15,020
for later on usage.
65
00:05:15,110 --> 00:05:21,290
OK, so let's say some textual file that we will be able to take this information to put it there and
66
00:05:21,290 --> 00:05:25,860
it will say and it will be stored, let's say, on our hard drive.
67
00:05:26,290 --> 00:05:26,720
OK.
68
00:05:28,310 --> 00:05:36,350
So that these weigh the printed result will still be on your computer, even after you close the program
69
00:05:36,360 --> 00:05:39,380
and even after you will restart your computer.
70
00:05:39,470 --> 00:05:47,150
OK, so now every time you would want to see the results that you've already devoted your time in to
71
00:05:47,150 --> 00:05:52,790
calculate them, you will simply open up this file without the need to wait until the calculations will
72
00:05:52,790 --> 00:05:59,340
be done once again and basically work with the data, look at it and do whatever you like, OK?
73
00:05:59,750 --> 00:06:00,830
Pretty awesome, isn't it?
74
00:06:01,770 --> 00:06:05,930
So there are also additional reasons for that.
75
00:06:05,930 --> 00:06:11,570
But one of them, a very useful reason, will be discussed in the following videos.
76
00:06:12,110 --> 00:06:18,140
But not all of them, of course, because we still need to sometime for the Syntex and for the actual
77
00:06:18,140 --> 00:06:19,010
technical stuff.
78
00:06:19,370 --> 00:06:23,790
But we will get also additional details, additional examples.
79
00:06:24,290 --> 00:06:26,770
So this is very important.
80
00:06:26,780 --> 00:06:29,210
Guys, don't you dare falling asleep.
81
00:06:29,540 --> 00:06:30,890
I'll see you in the next videos.
8217
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.