 Hello friends, I am Sanjay Gupta in this video. I am going to demonstrate you the use of Rewind function available in file handling in C programming Before starting you can note how you can search my YouTube channel You can type my name Sanjay Gupta in YouTube search. My channel will be available there. You can watch various programming related videos here Now I am going to implement solution of this problem So I am including two header files stdio.h and stdlib.h Now I am going to define main function Inside main function, I am declaring a file pointer Then a character array and character variable ch Now I am going to open a file Name of file is string.txt And I am opening this file in w plus port So w plus mode is a mode which provides you the facility for reading and writing So if you are opening a file in w plus mode It means you can read the contents which are available in a file as well as you can write contents into a file And if string.txt is not available, this w plus mode will create this file automatically Now I have to check whether this file is open successfully or not So I am applying this if condition Which will display an error message That is cannot open file and then exit This will terminate execution of the program. So if this condition is false, then the remaining statements which are Which will be implemented after this if condition will be executed So now I am going to write a printf Which will display Enter a line of text So this message will be displayed on output screen And that line of text will be received through gattus into str I am increasing the size to 50 Now I have to store this line of text into a file So I am calling fputus I am passing two arguments into it str and fb So fputus writes Strings into file So this str will be stored inside fb file pointer So after this writing operation file pointer will move to the end of file Now I am going to read this file again That is pointed through fb So file pointer is on end of file, but I want to read the file from the beginning So for that purpose, I am going to call revine function So revine function brings the file pointer at the beginning of file So if you want to move your file pointer From ending to the beginning of the file, then you can call revine function Then you can pass file pointer in it So after calling fputus file pointer will be moved to end of file But revine will bring that file pointer at the beginning of the file Now without closing and reopening this file, I can read the contents which are available in the file from the beginning So I have written a line of text into a file. Then I have called revine function So right now file pointer is at the beginning of the file So now I am applying a while loop Which will read the contents from the file So here I am calling fgetc function which will read a character from file Now I am checking whether this character is at equals to end of file or not So if it is equals to end of file, then I can break the loop Otherwise I can print the content on output screen with the help of printf So this way through this loop, I am going to read the contents which are available in in the file And those contents will be displayed on output screen After this, I can close the file And then I am writing return zero So this way I have implemented the revine function in front of you In this program, I am writing the data first into a file and then I am reading the entered data back And I am going to display that data on output screen And for that purpose, for reading writing purpose, I have used w plus mode Now I am going to execute this code It is asking for a line of text. So I am entering My name is Sanjay Gupta. I live in India So this text will be stored inside the file So I am pressing enter key that text has shifted to file and you can see it is displaying again on output screen because I am reading the Contained which is stored inside file with the help of fgetc function So This gattus function is reading the contain then fputc is sorry fputus is writing that contained into the file Then revine is bringing back file pointer at the beginning of file And through this loop, I am reading the contents of file and those contents are displayed on output screen Now I have to check the contents of string.txt So this Source code is stored in ctc and win folder with name test.c So this string.txt is created on that file Sorry on that location So I am opening ctc and win folder here. I have to press s so that I can Search the files starting with the name s Here you can see string.txt is available. I am opening this file You can see the content it is having the content. My name is sanjay gupta. I live in India So this is the text which I have entered on output screen. It is available in this file That's why this text is displayed again on output screen through this program So this way I have demonstrated you the use of revine function With the help of wplus mode I hope you have understood how we can use revine function In file handling in c programming If you want to watch more programming related videos, you can search my name sanjay gupta in youtube My channel will be available there. You can watch various programming related videos there Thank you for watching this video