454 Programming and Data Structures
int s*0,x*0j
clrscrO ;
f=fopen("poem.txt", "r");
f2=fopett("alpha.txt", "w ");
if (f==N ULL I I f l ~ N U L L )
I
perrorC'?”);
exit(l);
clrscrO;
while Ofeofff))
{
csfgetcif);
x++;
if (x = 9 9 )
(
fcloseallQ;
exitil);
I
else
ch[s++]=c;
I
fdoseifi;
fo r (s»0/s<=100;s++>
fputc(ch[s],f2);
fd o s eifi);
perror ("Process Completed ");
I
OUTPUT
Process Completed : Error 0
Explanation In the above program contents of file "poem . t x t " is read and copied to a character
array ch []. The same array is read and written to file " a lp h a . t x t " using fp u tc () function.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.244.250