6.f pu cc ( ) This function writes the character to the file shown by the file pointer. It also increases the
file pointer.
Syntax
f putc (c, f p) where, f p is file pointer and c is a variable written to the file pointed by file pointer.
13.12 Write a program to write text to a file using fputcO function.
# include <stdio.h>
# include <conio.h>
void main ()
{
FILE *fp;
char c;
clrscr();
fp=fopen(" lines. txt", "w");
if(fp==NULL)
return;
else
while ( <c=getche())!='*')
fputc(c,fp);
I
fclose(fp);
I
QUXPUT;
India is my country.
ExplanationIn the above program the text entered by the user ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.