关于fputc和fgetc谁能帮忙看下问题
#include <stdio.h>#include <string.h>
int main(int argc, const char *argv[])
{
if (argc!=2)
{
printf("please input path!\n");
return -1;
}
FILE* fp=fopen(argv[1],"r");
if (fp == NULL)
{
perror("fail to fopen ");
return -1;
}
while(1)
{
if(fgetc(fp)==EOF)
{
if(feof(fp))
break;
else
{
perror("fail to fgetc");
return -1;
}
}
fputc(fgetc(fp),stdout);
}
if(fclose(fp)==EOF)
{
perror("fail to fclose");
return -1;
}
return 0;
}
为什么打印会有缺少