鱼C论坛

 找回密码
 立即注册
查看: 2606|回复: 5

something about "fread() and fwrite()" ??

[复制链接]
发表于 2012-4-13 08:55:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include <stdio.h>
#include <stdlib.h>
#define SIZE 100

main(int argc, char *argv[])
{
  char a[SIZE];
  FILE *f1, *f2;
  if((f1=fopen(argv[1],"rb"))==NULL)
    {printf("The file:%s can not be opened.",argv[1]);exit(0);}
  if((f2=fopen(argv[2],"ab"))==NULL)
    {printf("The file:%s can not be opened.",argv[2]);exit(0);}
  while(fread(a,sizeof(char),SIZE,f1)==1)
    fwrite(a,sizeof(char),SIZE,f2);
  fclose(f1);
  fclose(f2);

}
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
 楼主| 发表于 2012-4-13 08:57:11 | 显示全部楼层
where is the problem? I try to make copy fuction. I run it . but nothing happen.
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2012-4-14 17:11:35 | 显示全部楼层
I don't know.
What are you talking?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2012-4-14 17:12:25 | 显示全部楼层
Pause speak Chinese.
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2012-4-14 17:18:02 | 显示全部楼层
Please speak Chinese, won't use the translation. I also like this.
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2012-4-14 17:21:26 | 显示全部楼层
if((f1=fopen(argv[1],"rb"))==NULL)
    {printf("The file:%s can not be opened.",argv[1]);exit(0);}
  if((f2=fopen(argv[2],"ab"))==NULL)
no: if((... ))==... )where is "("?
yes: if(((... ))==...)
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-3-28 21:56

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表