/* a11-1-2.c */
#include <stdio.h>
#include <ctype.h>

int main(void)
{
	FILE *fin, *fout;
	char infile[40], outfile[40];
	int c;

	printf("コピー元ファイル = ");
	scanf("%39s", infile);
	printf("コピー先ファイル = ");
	scanf("%39s", outfile);
	if( (fin = fopen(infile, "r") ) == NULL) {
		printf("Input file open error.\n");
		return 1;
	}
	if( (fout = fopen(outfile, "w") ) == NULL) {
		printf("Output file open error.\n");
		fclose(fin);
		return 1;
	}

	while( (c = fgetc(fin) ) != EOF) {
		c = tolower(c);
		fputc(c, fout);
	}

	fclose(fin);
	fclose(fout);

	return 0;
}
