Skip to Main Content
Programming and Data Structures
book

Programming and Data Structures

by Ashok Kamthane
August 2009
Intermediate to advanced content levelIntermediate to advanced
604 pages
21h 39m
English
Pearson India
Content preview from Programming and Data Structures
432 Programming and Data Structures
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 pu tc (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;
c l r s c r ( ) ;
fp=fopen(" lines. txt", "w ");
if(fp ==N U LL )
return;
else
while ( <c=getche())!='*')
fputc(c,fp);
I
fclose(fp);
I
QUXPUT;
India is my country.
Explanation In 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.
Start your free trial

You might also like

Learning Data Structures and Algorithms

Learning Data Structures and Algorithms

Rod Stephens
Data Structures and Algorithms in C++, Second Edition

Data Structures and Algorithms in C++, Second Edition

Michael T. Goodrich, Roberto Tamassia, David M. Mount

Publisher Resources

ISBN: 9789332506343