 Hello friends. I'm Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to explain how we can use fscanup function to read data from a file in file handling in C language, right? So, before start, if you go to description of this video, you will find links of various scalers related to C language videos. So, you can follow them through. Now I'm going to write a program where you will see how we can use fscanup to read the data. So, let's assume that we have this file already created and it is having a value stored as 30. So, name of file is data.txt and it is having a number that is 30. So, I'm going to read this number from file and another number I'm going to read from a user. So, I will be comparing both the numbers. The number which is entered by user and the number which is available into a file. If both are same, so I will be displaying numbers are equal otherwise, right? So, you can assume this program is like you enter your pin number while using ATM machine. So, you provide your pin number and your pin number is already stored in a file into ATM machine. So, ATM machine needs your pin number that is available in that machine and you yourself enter your pin number and it matches both if they are matched then you will be perceived further to do transactions otherwise you need to reenter your pin number. So, this kind of functionality I'm going to implement with the fscanup. So, starting from main, first of all, I'm declaring a file pointer. Then two in these are variables n1 and n2. Now, I'm going to open this file data.txt into read mode. Now remember that you need to provide the proper location of this file wherever it is available. So, let's say it is available in C drive in a particular folder and then name of file. So, if you have a fully qualified path, you need to put it here so that your file can be read successfully. Now, if file is not available or not present or if it is deleted by someone and still you are trying to open this in read mode. So, after this, you need to check file pointer with none. So, if your file pointer is containing none, it means your file is not available or you can say it is not open successfully or not found. So, here we can print the message printf file not found. So, if you display this kind of message, so user will see that your file is not found, it means the file which we are trying to read is not available. So, this message is important and after displaying this message, you can terminate the execution of the program with the help of this exact predefined function because if file is not present, then there is no need to execute the program. So, we can terminate it here only and the statements which are available after this condition will not be evaluated. And if your file is open successfully and your file pointer is having a particular address, then this if condition will be false. After that, you can write enter a number. So, this is for user. So, the user will be entering the number and that I am going to need to scan us. So, the number which is entered by the user is available in N1 variable. Now, we need to write a statement to which we can read this number which is available into a file. So, for that you need to write F scan F, then file pointer which is linked with this file, percent D because number is integer type and that will be stored into N2 variable. So, you need to know the type of value which is already stored into a file. If you don't know the exact type of data which is available into the file, then the data which you are going to read will convert into garbage. So, the data which you are writing into a file, I hope you will be reading that. So, it means the data.txt will be created by you and you will be putting 13 form of numbers and then you will be able to read it. If it is containing flow values, you would have used here for example, right? After this, we can apply a simple F condition that is N1, W equals to N2. If both are equal, you can print equal else, you can print not equal. And at last, you can write F close F equal. So, you can close your file because we have already taken input the number which is available into the file and we have compared it with the number that is provided by the user through console. So, this way I hope you understood how we can use fscarab to read a particular data from file. If you have load values or any other data type that is stored into this file, so accordingly you can change your type. So, right now we are using N2 as in, so further you can change it to load and in place of % you can use %f. So, whatever type of data is available into file, accordingly you can change your variable type and format spacecraft so that fscarab can read your data in proper form. So, I hope you understood how we can use fscarab to read data from file. So, this is very simple program you can implement in your laptop or desktop. And if you want to watch more programs related to file handling, so at the end of video you will find the link of file handling. So, you can open that and there are videos related to file handling. So, you can watch them and thank you for watching this video.