#include int main (int argc, char * argv []) { if (argc != 3) { printf("usage: %s \n", argv[0]); return 1; } FILE * src = fopen(argv[1], "r"); if (src == 0) { printf("could not open source file %s\n", argv[1]); return 1; } FILE * dst = fopen(argv[2], "w"); if (dst == 0) { printf("could not open destination file %s\n", argv[2]); fclose(src); return 1; } int c; while ((c = fgetc(src)) != EOF) { if (fputc(c, dst) == EOF) { printf("could not write onto destination file %s\n", argv[2]); fclose(src); fclose(dst); return 1; } } fclose(src); fclose(dst); }