1
00:00:01,520 --> 00:00:02,120
Hi everyone.

2
00:00:02,120 --> 00:00:08,670
So in this video we want to understand the difference between the text file and the binary files so

3
00:00:09,360 --> 00:00:12,960
the definition is very simple text file that those file that are human literally.

4
00:00:12,960 --> 00:00:19,500
Well so basically human can easily read text files but binary files are not very human friendly so they

5
00:00:19,500 --> 00:00:27,540
are basically machine readable now let's see how the data will be stored in text and the binary file.

6
00:00:27,540 --> 00:00:33,140
So for example in your program if you're doing something like this in Texas 23.

7
00:00:33,360 --> 00:00:36,480
So if you want to store the data in binary files so what will happen.

8
00:00:36,490 --> 00:00:37,790
So this 23.

9
00:00:37,890 --> 00:00:39,820
So what is a binary representation of twenty.

10
00:00:39,810 --> 00:00:44,070
So this is 1 0 1 1 1.

11
00:00:44,070 --> 00:00:49,070
And we know basically integer is of 4 bytes so 4 bytes means 32 bits.

12
00:00:49,080 --> 00:00:59,200
So basically in binary what will happen you will have to do two bits so these are two little bits first

13
00:00:59,290 --> 00:01:06,940
eight bits are all zeros the next eight bits are also all zeros the next eight bits are also all zeros.

14
00:01:07,420 --> 00:01:13,900
So then here you have 1 0 1 1 1 and then there are three zeros.

15
00:01:13,900 --> 00:01:16,320
So basically this will be stored in your binary file.

16
00:01:16,320 --> 00:01:18,110
So this is 0 0 0 0.

17
00:01:18,130 --> 00:01:19,800
You can write all the zeros.

18
00:01:19,810 --> 00:01:22,360
And finally you will have 1 0 1 1 1.

19
00:01:22,890 --> 00:01:23,130
Okay.

20
00:01:23,140 --> 00:01:27,720
So you're buying verifiable stored data in this format.

21
00:01:27,740 --> 00:01:31,890
Now let's see how this string degree will be stored in our text file.

22
00:01:31,940 --> 00:01:36,410
So what will happen first of all this too will be converted into into its archive and do so ask any

23
00:01:36,410 --> 00:01:38,270
value of two is actually 50.

24
00:01:38,480 --> 00:01:44,530
Similarly t will be converted into its ask value and ask the value of trees 51 so missing really my

25
00:01:44,530 --> 00:01:51,790
mother to ask a value of 0 is 49 and similarly it will go on so that I ask a value of when will be fifty

26
00:01:52,120 --> 00:01:55,800
and it will go on like this so what will happen.

27
00:01:55,800 --> 00:01:59,880
This tool is going to be converted in goods ask a character called.

28
00:01:59,880 --> 00:02:01,380
So this value is actually 50.

29
00:02:01,380 --> 00:02:02,700
So what will happen.

30
00:02:02,850 --> 00:02:09,850
So this 50 is going to be converted into its binary form and its binary farmers 1 1 0 0 1 0.

31
00:02:09,990 --> 00:02:19,860
And similarly the binary form of 51 is 1 1 0 0 1 1 and basically ask take only one bit so you take only

32
00:02:19,860 --> 00:02:26,350
one byte so how many boots are there one two three four five and six so two zeros will be appended here

33
00:02:26,680 --> 00:02:30,960
and twos the list will be appended here then in the text format what will happen.

34
00:02:30,970 --> 00:02:32,470
I was told it in this format.

35
00:02:32,530 --> 00:02:35,660
1 0 0 1 1 0 0 1 0.

36
00:02:35,710 --> 00:02:38,760
So this thing and now I restored this thing.

37
00:02:38,800 --> 00:02:44,020
So this is actually 0 0 then 1 1 0 0 1 1.

38
00:02:44,140 --> 00:02:50,650
So this is how I was told the data in the text file and this is how I will store the data in our binary

39
00:02:50,650 --> 00:02:51,300
file.

40
00:02:51,310 --> 00:02:56,250
Now I told you that the text files are human readable but I don't think this is your money really well

41
00:02:57,190 --> 00:02:58,370
so why I told you that.

42
00:02:58,410 --> 00:02:59,740
Takes to until you manage really well.

43
00:02:59,750 --> 00:03:00,880
So let's discuss.

44
00:03:00,900 --> 00:03:04,930
So what will happen you will open the text file into your notepad.

45
00:03:05,140 --> 00:03:14,920
Now what nobody will do so it will pick the first 8 bits it will pick the first 8 bits and it will convert

46
00:03:14,990 --> 00:03:16,150
into its ask value.

47
00:03:16,180 --> 00:03:20,920
So this is going to lose actually Fifty and fifty is corresponding to three of these corresponding to

48
00:03:20,920 --> 00:03:21,430
two.

49
00:03:21,490 --> 00:03:24,280
So instead of this the notepad will print two.

50
00:03:24,460 --> 00:03:27,520
Similarly it will pick the next eight bits.

51
00:03:27,670 --> 00:03:33,340
Again it will find out the ask value which is fifty one then the character corresponding 251 is three

52
00:03:33,640 --> 00:03:34,890
so three will get printed.

53
00:03:34,930 --> 00:03:38,500
If you will open the file in notepad but this is binary.

54
00:03:38,710 --> 00:03:41,400
So if you will open the binary filing notepad.

55
00:03:41,470 --> 00:03:42,180
So what will happen.

56
00:03:42,180 --> 00:03:44,560
It will pick the first 8 bits.

57
00:03:44,560 --> 00:03:50,140
So the first 8 bits are actually 0 also the first eight which set actually 0.

58
00:03:50,140 --> 00:03:51,210
So it will happen.

59
00:03:51,250 --> 00:03:55,000
The correct corresponding to ask I lose you know will get printed.

60
00:03:55,000 --> 00:03:58,960
So what is the character corresponding to the sky values 0.

61
00:03:59,040 --> 00:04:04,990
So ask a value 0 and the character corresponding to asking will lose zero sum will be a very meaningful

62
00:04:04,990 --> 00:04:05,580
character.

63
00:04:05,680 --> 00:04:09,600
Very strange Celtic Bill question mark or it can be anything.

64
00:04:09,760 --> 00:04:13,320
So we know that there will be some asking will look corresponding.

65
00:04:13,420 --> 00:04:14,270
I think it is nil.

66
00:04:14,320 --> 00:04:17,730
Yes I remember it isn't an so this isn't that.

67
00:04:17,750 --> 00:04:22,050
So what will happen now it will get printed again the next eight which are evil.

68
00:04:22,330 --> 00:04:24,340
So again none will get printed.

69
00:04:24,340 --> 00:04:26,050
Again the next asking value of zero.

70
00:04:26,060 --> 00:04:28,090
So again none value will be rendered.

71
00:04:28,240 --> 00:04:31,770
And this is actually so what is this number.

72
00:04:32,590 --> 00:04:33,910
So this number was twenty three.

73
00:04:33,910 --> 00:04:39,340
So the asking value corresponding to quantity will get printed and it will be a very strong symbol.

74
00:04:39,730 --> 00:04:41,910
So let's say this question mark.

75
00:04:42,100 --> 00:04:44,050
It will be a very meaningful symbol.

76
00:04:44,050 --> 00:04:45,420
So finally what will we had output.

77
00:04:45,430 --> 00:04:51,070
This will be it output to fill open the file if you open the binary file in notepad so and we know this

78
00:04:51,070 --> 00:04:53,660
is very meaningful to us.

79
00:04:53,830 --> 00:04:56,140
So this is under meaningful unintelligible

80
00:04:59,390 --> 00:05:02,000
so this thing is unintelligible.

81
00:05:02,210 --> 00:05:09,560
So that's why I told you that the text files are actually humility devil and the binary files are basically

82
00:05:09,560 --> 00:05:10,340
machine readable.

83
00:05:11,540 --> 00:05:19,210
So how can we read and write it out into the text file so we can use these operators so we can use this

84
00:05:19,210 --> 00:05:21,850
operator to read and write it into a text file.

85
00:05:21,850 --> 00:05:28,300
Now if you want to read and write data in two binary file then basically in C++ you have a mode and

86
00:05:28,300 --> 00:05:31,960
this mode is actually a US I don't remember exactly.

87
00:05:32,380 --> 00:05:34,140
So I think it is a US binary.

88
00:05:35,890 --> 00:05:41,230
So this is the mode if you want to take if you want to read and write data to a binary file and there

89
00:05:41,230 --> 00:05:42,370
are also functions.

90
00:05:42,490 --> 00:05:46,000
So the functions are doing the function to read the data.

91
00:05:46,420 --> 00:05:55,530
And similarly you have a function right so this read function is actually in the class ice cream.

92
00:05:55,540 --> 00:05:57,310
I think it is input stream.

93
00:05:57,820 --> 00:06:06,120
And similarly the right function is present in the class output stream.

94
00:06:06,180 --> 00:06:08,150
Now let's discuss which one is faster.

95
00:06:08,520 --> 00:06:14,760
So text or binary so actually binary our faster binary files are faster and the text files a slower

96
00:06:14,790 --> 00:06:19,040
via this slower it is slower because of the conclusion.

97
00:06:19,080 --> 00:06:23,180
So this is how we are studying the data and this is how we are displaying the data.

98
00:06:23,190 --> 00:06:28,840
So basically there is some calculation involved and you do the calculation it becomes slower and it

99
00:06:28,850 --> 00:06:34,620
is faster now let us discuss which will take more space.

100
00:06:34,650 --> 00:06:40,260
So basically this is going to take more space why more space.

101
00:06:40,260 --> 00:06:46,480
And this is going to take less space so let us consider one example so suppose you want to store this

102
00:06:46,480 --> 00:06:47,290
number.

103
00:06:47,290 --> 00:06:50,970
So you have something like an X equals let's say a bigger number.

104
00:06:51,190 --> 00:06:56,320
So let's say 4 7 3 2 5 and 6.

105
00:06:56,320 --> 00:07:00,060
Now if you want to store this number in binary what will happen.

106
00:07:00,070 --> 00:07:05,990
So again binary integer is basically 32 bits or we can say for bytes.

107
00:07:06,010 --> 00:07:11,550
So if you want to store this number in binary it will take four bytes simple.

108
00:07:11,770 --> 00:07:13,080
So just like here.

109
00:07:13,420 --> 00:07:17,460
It is going to take four bytes or you can set twenty two bits.

110
00:07:17,470 --> 00:07:20,370
Now let's see how much space will be taken.

111
00:07:20,500 --> 00:07:22,990
If I want to store this number in the text file.

112
00:07:22,990 --> 00:07:24,100
So again what will happen.

113
00:07:24,100 --> 00:07:33,120
Each digit will be converted to ask value and we know the square value is basically one byte you can

114
00:07:33,120 --> 00:07:33,360
see.

115
00:07:33,360 --> 00:07:39,660
So this is one byte so this is one byte then two byte then three then four and five and six.

116
00:07:39,660 --> 00:07:47,440
So if you want to store this number in the text format in the text format you will take six bytes so

117
00:07:47,470 --> 00:07:53,650
each digit will take one byte so you will take six bytes here and you are taking only four bytes here.

118
00:07:54,220 --> 00:08:02,480
So it's a binary files are taking less space in binary files are faster now the only advantage that

119
00:08:02,540 --> 00:08:06,080
text file have is basically the added human leader table.

120
00:08:06,080 --> 00:08:12,080
So this is the only advantage the text file not having that they are human leader table and binary files

121
00:08:12,090 --> 00:08:17,390
are basically machine readable rest everything binary files will win.

122
00:08:17,530 --> 00:08:24,720
So binary files are Foster and binary files are taking less space and I want this text file has is basically

123
00:08:24,780 --> 00:08:29,260
we can understand them and we can not understand designed to be filed.

124
00:08:29,460 --> 00:08:32,840
So that is all about the text and the binary file.

125
00:08:33,600 --> 00:08:35,530
So I will see you in the next video by.
