 Hello friends. I am Sanjay Gupta. In this video, I am going to demonstrate you how you can print source code of a C program on output screen using file handling in C programming. Before starting, you can know 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 previous programming related videos here. Now I am going to demonstrate you how you can print source code of a C program on output screen with the help of file handling. So I am including first header file stdio and second header file that is stdlib.h. Now I am going to define main function. Inside main function, I am declaring a file pointer that is p and a character variable that is ch. Now I am going to open the file whose contents I want to display on output screen. So you can see this file name is test.c and I am going to display content of this file which is right now I am creating. So on output screen, content of this file will be displayed as output. So name of file is test.c and its opening mode is r. Now I have to check whether this file will be opened successfully or not. So if fp is containing null, it means file is not opened successfully. So I have to print this error message that is file is not opened and I am calling exit function so that I can terminate execution of the program. So this source code which is I am typing right now is saved in test.c file and I have opened this file with f open function. So it means the content which is I am typing right now will be displayed as output on output screen. Now I am going to implement an infinite loop which will read contents of test.c file and those contents will be displayed on output screen. So for reading purpose I am calling fgetc and I am passing file pointer fp. The received content will be stored inside ch. Now I am checking whether ch is equals to EOF or not. EOF means end of file. Each file contains end of file mark at the end of it. So if ch is equals to EOF it means file is not containing more characters now. So I can break the loop. Otherwise I can call printf which will display the received character on output screen. So this way I have implemented the loop. fgetc will be reading a character and printf will be displaying that character on output screen. After completion of this loop I can close the file and then return 0. So this way I have implemented the complete program in front of you. The code which I have typed right now it will be displayed on output screen as output. So you will see after execution I am going to execute this code. You can see the output. The code which I have typed right now is displayed on output screen. You can match it. The code which I have typed is available on output screen as output. So this is done with the help of file handling in C. I hope you have understood how I have displayed the source code as output on output screen with the help of file handling in C programming. If you want to watch more programming related videos you can search my YouTube channel by my name Sanjay Gupta in YouTube search bar. My channel will be available there. You can watch various programming related videos here. Thank you for watching this video.