#include<stdio.h>
#include<conio.h>
#include<process.h>
void main()
{
FILE *f;
char c;
clrscr();
printf("\n contents of file before appending");
f=fopen("balaram.txt","r");
while(!feof(f))
{
c=fgetc(f);
printf("%c",c);
}
f=fopen("balaram.txt","a");
if(f==NULL)
{
printf("File can not appending");
exit(1);
}
printf("\n Enter string to append:");
while(c!='.')
{
c=getche();
fputc(c,f);
}
fclose(f);
printf("\n contents of file after appending:\n");
f=fopen("balaram.txt","r");
while(!feof(f))
{
c=fgetc(f);
printf("%c",c);
}
}
No comments:
Post a Comment