close
#include
#include
#include
void main (void)
{
FILE *rptr, *wptr;
char string[80];
if((rptr=fopen("input.txt","r"))==NULL)
{ printf("The input file can not be opened !\n");
exit(1);
}
else
printf("The input file can be opened !\n");
if((wptr=fopen("output.txt","w"))==NULL)
{
printf("The output file can not be opened !\n");
exit(1);
}
else
printf("The output file can be opened !\n");
while(fscanf(rptr,"%s",string)!=EOF)
{
printf("%s", string);
fpintf(wptr,"%s\n", string);
}
fclose(rptr);
fclose(wptr);
}
#include
#include
void main (void)
{
FILE *rptr, *wptr;
char string[80];
if((rptr=fopen("input.txt","r"))==NULL)
{ printf("The input file can not be opened !\n");
exit(1);
}
else
printf("The input file can be opened !\n");
if((wptr=fopen("output.txt","w"))==NULL)
{
printf("The output file can not be opened !\n");
exit(1);
}
else
printf("The output file can be opened !\n");
while(fscanf(rptr,"%s",string)!=EOF)
{
printf("%s", string);
fpintf(wptr,"%s\n", string);
}
fclose(rptr);
fclose(wptr);
}
全站熱搜
留言列表