1、
#include <stdio.h> int main(void) { int ch; FILE *sfp; FILE *dfp; char sfile[FILENAME_MAX]; char dfile[FILENAME_MAX]; printf("source file name: "); scanf("%s", sfile); printf("destinatiom file name: "); scanf("%s", dfile); if((sfp = fopen(sfile, "rb")) == NULL) printf("\aSfile open failed.\n"); else { if((dfp = fopen(dfile, "wb")) == NULL) printf("\aDfile open failed.\n"); else { int n; while((n = fread(&ch, sizeof(int), 1, sfp)) > 0) { fwrite(&ch, sizeof(int), 1, dfp); } fclose(dfp); } fclose(sfp); } }