 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can store five different line of text in file using Fputter's function in C programming. Before starting, you can note how you can search my YouTube channel. You can type my name Sanjay Gupta in YouTube. My channel will be available where you can watch various programming related videos here. Now I am going to implement solution of this problem. First I am including header file stdio.h, another header file that is stdlib.h. After inclusion of these header files, I am defining main function. Inside main function, I am declaring a file pointer, then a character array that is str. Now I have to open a file in which I am going to store these line of text. So in fopen function, I am writing name of file as line.txt and I am going to open it in write mode. So if this file is already available, its previous contents will be erased automatically and if this file is not available, it will be created automatically. Now I have to check whether it is opened successfully or not. So if fp is containing null, it means file is not opened successfully. So I can print an error message, cannot open file and I can call exit function. So exit will terminate execution of the program if file is not opened. If file is opened successfully, then this if condition will be false and remaining statements after this if condition will be executed. Now I have to implement a for loop so that I can read 5 different line of text. So I am declaring integer variable i. I am applying a for loop. This for loop will repeat 5 times. Now inside this for loop, first I have to display message on output screen, enter %line. So this print as will print, enter first line, enter second line, enter third line and so on. Then to receive the entered line, I am calling getters function and the entered line will be stored inside str. Now I have to store that entered content into a file. So I am going to call fputters, then I am passing str into this fputters function and I am passing file pointer. So str will be stored inside this fp file pointer. File pointer is pointing to line.txt. So all the lines will be stored inside this line.txt file. After completion of this loop, I can close the file by calling fclose function and then return 0. So this way I have implemented the solution of this problem in front of you, which will read 5 lines of text from user and those lines will be stored inside a file. Now I am going to execute this code. It is asking for first line. I am entering my name that is Sanjay Gupta. It is asking for second line. I am entering I love India. It is asking for third line. I am going to enter tax school. It is asking for fourth line. I am entering C programming. It is asking for fifth line. I am entering file handling. So this way I have entered 5 different lines. Now the program has ended. It is executed successfully. Now I have to check whether line.txt is containing the content which I have entered while execution of this program. So this source code is saved with test.c name and the location is CTC bin. So this line.txt must be present in this location only. So I am moving to bin folder. You can see the path C drive tc folder and bin folder. Inside this folder you can see line.txt is available here. It must be containing the content which I have entered at the time of execution. So I have opened this file. You can see the content which I have entered at the time of execution is available here. Sanjay Gupta, I love India, tax school, C programming and file handling. All the lines are available in this file but they are not available in separate lines. Because I have not used slash n. So all the contents are available in the file. If you want to place slash n then you can write this also. F code is inside double quotes I am writing slash n and FB. This time the enter text will be available in separate lines. So again I am going to execute this code. Now I am again entering five different lines. So I have entered all the inputs. Again I am moving to bin folder. Now you can see the output. This time all the lines are available in separate lines because I have also entered slash n. So this way I have demonstrated you how you can store different different lines into a file with the help of F protest function available in file handling in C. So I hope you have understood whatever I have demonstrated you in this program. If you want to watch more programming related videos you can search my name Sanjay Gupta in YouTube. You can also download my android app Techimates which is available on Google Play. Thank you for watching this video.