将一个磁盘信息复制到另一个磁盘

int main(int argc, const char * argv[]) {
    FILE *in,*out;
    char ch,infile[10],outfile[10];
    scanf("%s %s",infile,outfile);
    if ((in=fopen(infile, "r"))==NULL) {
        printf("无法打开此文件");
        exit(0);
    }
    if ((out=fopen(outfile, "w"))==NULL) {
        printf("无法打开");
        exit(0);
    }
    while (!feof(in)) {
        ch=fgetc(in);
        fputc(ch, out);
        putchar(ch);
    }
    putchar(10);
    fclose(in);
    fclose(out);
    return 0;
}

 

posted @ 2017-07-13 19:10  零度咖啡  阅读(95)  评论(0)    收藏  举报