磁盘文件的复制出现乱码!fgetc,fputc!
以下是程序,和书书上一样,但是输出的文件中存在乱码,多了一个y上面两点的字符!各位帮忙想想是什么原因!多谢了!#include <stdio.h>
#include <stdlib.h>
void main()
{
FILE *read ,*write;
char fileread[10], filewrite[10],ch;
printf("请输入读文件的文件名:\n");
scanf("%s",fileread);
printf("请输入写文件的文件名:\n");
scanf("%s",filewrite);
if ((read=fopen(fileread,"rb"))==NULL)
{
printf("error!\n");
exit(0);
}
if ((write=fopen(filewrite,"wb"))==NULL)
{
printf("error!\n");
exit(0);
}
while (!feof(read))
{
fputc(fgetc(read),write);//个人感觉问题所在处
}
fclose(read);
fclose(write);
}