您的位置:首页 > 其它

多一个等号,足以让你文件不断增大

2011-11-14 02:34 106 查看
就多了一个等号,就把程序给搞到无限循环了。

 

#include <stdio.h>
int main(int argCount, char *argValue[])
{
FILE *srcFile = 0, *destFile = 0;
int ch = 0;
if (argCount != 3)
{
printf("Usage: %s src-file-name des-file-name\n",argValue[0]);
}
else
{
if ((srcFile = fopen(argValue[1],"r")) == 0)
{
printf("Can not open source file \" %s \" !",argValue[1]);
}
else
{
if ((destFile = fopen(argValue[2],"w")) == 0)
{
printf("Can not open desitination file \" %s \" !",argValue[2]);
fclose(srcFile);
}
else
{
while ((ch =/*在这里多了一个=号*/ fgetc(srcFile)) != EOF)
{
fputc(ch, destFile);
}
printf("Successful to copy a file ! \n");
fclose(srcFile);
fclose(destFile);
return 0;
}
}
}


 

 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  file
相关文章推荐