zoukankan      html  css  js  c++  java
  • 标准字符cp功能

    #include<stdio.h>
    #include<fcntl.h>
    
    int main(int argc,char *argv[])
    {
        FILE *src_fp,*des_fp;
        int src_ret;
    
        if(argc<3)
        {
            printf("please input parameter");
            return -1;
        }
    
        //打开源文件
        src_fp = fopen(argv[1],"r");
        if(src_fp == NULL)
        {
            printf("open the file %s is failure
    ",argv[1]);
            return -2;
        }
        printf("open the file %s is success
    ",argv[1]);
    
        //打开目的文件
        des_fp = fopen(argv[2],"w");
        if(des_fp == NULL)
        {
            printf("open the file %s is failure
    ",argv[2]);
            return -3;
        }
        printf("open the file %s is success
    ",argv[2]);
    
        //将源文件拷到目的文件中
        while(1)
        {
            src_ret = fgetc(src_fp);
            if(feof(src_fp))
            {
                printf("the file is end
    ");
                break;
            }
            fputc(src_ret,des_fp);
        }
    
        //关闭文件流
        fclose(src_fp);
        fclose(des_fp);
        return 0;
    }
  • 相关阅读:
    ARTS习惯(8)
    ARTS习惯(7)
    ARTS习惯(6)
    ARTS习惯(5)
    ARTS习惯(4)
    ARTS习惯(3)
    线程状态
    java线程同步
    数据库视图
    数据库事务
  • 原文地址:https://www.cnblogs.com/eeexu123/p/5512257.html
Copyright © 2011-2022 走看看