Append Something to the file
write something new into file sample.txt without earsing the exisiting content.
fptr = fopen("sample.txt", "a");
if (fptr == NULL)
printf("Cannot open file \n");
fopen() to open the specified file. "sample.txt" is file name. "a" denotes open it in write mode and keep existing content. So write starts from last.
Fprintf() writes the content into the file.
Note: sample.txt should exsist in the same folder where your program is located.