In this program, we are going to share how to write a sentence to a file using C programming language. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a C program to write a sentence to a file with the output.
Copy the below C program and execute it with the help of Turbo C compiler. At the end of this program, We have shared the output of this program.
fptr = fopen("program.txt", "w");
if(fptr == NULL)
printf("Please enter a sentence:\n");
Please enter a sentence:
I am trying to learn c programming.
Liked this program? Do Like & share with your friends.
Tags: c program to read a file, c program to read a string of text from file, c program to read and write to a file, c program to write data into a file, c programs, c programs with output, c programs with solutions, list of important c programs, writing to a file in c