#include #include #define MAX 250 main(void) { char buff[MAX]; char infile[80]; char outfile[80]; char name[21]; FILE *infp, *outfp ; printf("入力ファイル名="); scanf("%s",infile); if((infp=fopen(infile,"rt"))==NULL) { printf("%s file not open\n",infile); return(1); } while(fgets(buff,MAX,infp)!=NULL) { strncpy(name,buff,20); name[20]='\0'; printf("%s",name); printf(" に対する出力ファイル名="); scanf("%s",outfile); if(outfile[0] != '/') { if((outfp=fopen(outfile,"wt"))==NULL) { printf("%s file not open\n"); return(1); } fputs(buff,outfp); fclose(outfp); } } fclose(infp); return(0); }