|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define SIZE 30
int main(void)
{
char source[SIZE];
char target[SIZE];
char ch;
FILE *fp;
FILE *fa;
printf("Enter the source file:\n");
gets(source);
if ((fp = fopen(source, "r")) == NULL)
{
printf("Can't open the %s file.\n", source);
exit(EXIT_FAILURE);
}
printf("Enter the target file.\n");
gets(target);
if ((fa = fopen(target, "w")) == NULL)
{
printf("Can't open the %s file.\n", target);
exit(EXIT_FAILURE);
}
while ((ch = getc(source)) != EOF)
{
ch = toupper(ch);
putc(ch, target);
}
if (fclose(source) == NULL)
printf("Can't close %s file.\n", source);
if (fclose(target) == NULL)
printf("Can't close %s file.\n", target);
getchar();
return 0;
}
为什么在while循环哪里会发生访问冲突?
|
|