Chinaunix首页 | 论坛 | 博客
  • 博客访问: 363789
  • 博文数量: 53
  • 博客积分: 2000
  • 博客等级: 大尉
  • 技术积分: 1143
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-14 11:53
文章分类

全部博文(53)

文章存档

2011年(1)

2008年(52)

我的朋友

分类: C/C++

2008-09-12 20:18:52

int fileCopy()
{
    char ch;  
    FILE *fin;
    FILE *fout;  
   
    if((fin = fopen("in.xx", "rb")) == NULL)   //也可以以"rt"文本方式打开
    {  
        printf("can't open the file/n");  
        return (-1);  
    }  
   
    if((fout = fopen("out.xx", "wb")) == NULL)   //也可以以"rt"文本方式打开
    {  
        printf("can't open the file/n");  
        return (-1);  
    }  
 
    while(!feof(fin))  
    {  
        ch = fgetc(fin);  
        if(ch != EOF)     //在这里加一个条件判断便可  
            fputc(ch, fout);  
    } 
    
    fclose(fin);  
    fclose(fout); 
 
    system("PAUSE"); 
    return 0;
}
阅读(1766) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~