linux c copy文件内容

/*
 * copy_file.c
 *
 *  Created on: Apr 6, 2013
 *      Author: jwang
 */

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {

    int c;
    FILE *in, *out;

    in = fopen("/root/workspace/Test/Debug/file.in", "r");
    out = fopen("/root/workspace/Test/Debug/file.out", "w");

    while ((c = fgetc(in)) != EOF) {
        printf("%c", c);
        fputc(c, out);
    }
    exit(0);
}


你可能感兴趣的:(linux c copy文件内容)