#include<stdio.h>
#include<conio.h>
struct file
{
char words[30];
}fl[6];
struct file1
{
char words[30];
}fl1[6];
int main()
{
FILE*fdata1,*fdata2;
int index1,index2;
int n=5;
{
fdata1=fopen("D:\\123.txt","a+");
if(fdata1==NULL)
{
printf("ERROR");
}
else
{
for(index1=0;index1<n;index1++)
{
fscanf(fdata1,"%s",&fl[index1].words);
}
fclose(fdata1);
fdata1=fopen("D:\\123.txt","a");
fdata2=fopen("D:\\456.txt","a");
if(fdata2==NULL)
{
printf("ERROR");
}
else
{
for(index2=0;index2<n;index2++)
{
fprintf(fdata2,"%s\n",fl[index2].words);
fprintf(fdata2,"Acknowledgement
send\n");
fprintf(fdata1,"Acknowledgement
recieved for \t");
fprintf(fdata1,"%s\n",fl[index2].words);
}
}
}
fclose(fdata1);
fclose(fdata2);
getch();
}
}
No comments:
Write comments