next up previous contents
Next: 補足説明 Up: 例題2 Previous: 例題2   Contents

解答


#include <stdio.h>
#include <stdlib.h>
void main(){
FILE *fpr, *fpw;
int c;
if( (fpr = fopen(”test1.dat”,”r”)) == NULL ){
printf(”ファイル test1.datがオープンできません\n”);
exit(0);
}
if( (fpw = fopen(”test2.dat”,”w”)) == NULL ){
printf(”ファイル test2.datがオープンできません\n”);
exit(0);
}
while( (c = getc(fpr)) != EOF ){
putc(c, fpw);
}
fclose(fpr);
fclose(fpw);
}



kojima hirohisa
2001-03-05