WEBVTT 00:01.680 --> 00:09.010 Regan News 10 provided read and write methods of the file class to read and write to the file. 00:10.440 --> 00:16.830 It depends on which mode of file was opened and let's see this by creating a program. 00:22.910 --> 00:24.570 Let's say the message 00:30.350 --> 00:30.650 Hello 00:34.850 --> 00:35.300 or 00:46.400 --> 00:55.570 the text file equal to. 00:55.790 --> 00:59.890 This is the Open Method of the file. 00:59.890 --> 01:04.880 Class and here is specify the file name. 01:05.330 --> 01:07.400 Message dot. 01:08.870 --> 01:14.000 And the more means write W for right are for read 01:19.730 --> 01:26.490 so by default message dot the X2 file will be created in the spot. 01:27.740 --> 01:36.750 But if you want to create it in another part we need to specify that bug in the file only. 01:36.790 --> 01:39.310 Suppose we want to create a different world order 01:42.410 --> 01:44.410 or the name 01:57.890 --> 02:04.970 say x file right. 02:05.170 --> 02:06.010 This message 02:11.720 --> 02:17.710 then in the end we call the close method of the file. 02:18.210 --> 02:22.730 But back we have done working on the file close 02:25.880 --> 02:27.600 to save this program. 02:30.790 --> 02:41.130 As I write say I'll run this program 02:44.310 --> 02:51.900 see letter folder is the file which God created 02:56.780 --> 03:00.860 now let's see how to read a file. 03:01.200 --> 03:02.380 We'll create another file 03:05.210 --> 03:12.290 a message to say I'm fine 03:22.980 --> 03:23.340 let's 03:27.330 --> 03:29.300 read the file. 03:30.640 --> 03:30.860 But 03:34.780 --> 03:38.210 or read more is the default mode. 03:38.310 --> 03:42.420 We don't have to specify it like say a text file. 03:43.390 --> 03:47.100 It goes to open 03:50.240 --> 03:51.830 boil. 03:52.130 --> 03:58.390 Third underscore her message to the 04:01.210 --> 04:03.820 so there is no more to specify. 04:04.150 --> 04:08.300 There's no more specified then by default. 04:08.450 --> 04:15.950 So read more so we say we use a while loop as there could be multiple lines 04:18.630 --> 04:19.680 say a line. 04:19.680 --> 04:24.000 People to text file dot read 04:27.640 --> 04:34.110 to see if blank line equals equals zero. 04:38.020 --> 04:50.210 It means that if it's the end of file there is no line then break open the line 04:53.880 --> 04:57.940 then again text file not close. 05:01.970 --> 05:04.260 I will execute this program again. 05:08.300 --> 05:09.150 So I'm fine 05:13.420 --> 05:17.920 after reading or writing to the file we see the goal module.