多一个等号,足以让你文件不断增大
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; } } }
相关文章推荐
- 一个哥们看到数据库日志不断增大 [log_reuse_wait_desc]为replication 之后的做法
- 自己编写的一个库文件,还在不断丰富中,欢迎使用
- 用c写一个简单json处理器之头文件,可能会不断完善吧(二)
- Java Applet 实现一个半径不断增大的彩色小球动画
- Java Applet 实现一个半径不断增大的彩色小球动画
- Linux常用命令:文件解压缩、去重、合并为一个文件、一个文件的指定行写入另一个文件(不断更新中...)
- BAM部署失败 - 未能加载”AdomdClient”或它的某一个依赖项。系统找不到指定的文件
- 使用python logging处理多机多进程写同一个日志文件
- 今天碰到一个poi解析excel文件的时候报错, 后来发现是这个excel文件单元格里面有公式。删除公式问题解决!
- day20打印流,删除一个带内容的目录,用于记录应用程序运行次数,多个读取流变成一个读取流,切割文件
- log4net 配置允许同时写日志到同一个文件
- 使用一个pcap包生成kml文件
- 记录系统当前时间到一个文件中
- 删除一个目录下所有文件及文件夹 BOOL DeleteDirectory(LPCTSTR pszPath)
- 算法设计时是否要设计一个针对文件的版本?
- 修改一个类ini文件中某几个变量的值的C代码
- 查询一个文件里面的内容是否出现在另一个文件里
- 代码来解决多进程/线程同时读写一个文件的问题。
- 如何快速运行一个php文件
- 使用数字来修改一个文件的存取权限