69,371
社区成员
发帖
与我相关
我的任务
分享
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int main(void)
{
int ch;
FILE *source,*destination;
char source_name[41],destination_name[41];
printf("input the source file's name:");
if ( (source = fopen(gets(source_name),"r")) == NULL)
{
printf ("Can't open %s\n", source_name);
exit(1);
}
printf("input the destination file's name:");
if ( (destination = fopen(gets(destination_name),"w")) == NULL)
{
printf ("Can't open %s\n", destination_name);
exit(1);
}
while ((ch = getc(source)) != EOF)
putc( toupper(ch), destination );
fclose(source);
fclose(destination);
printf ("copy finished\n");
return 0;
}