#include<stdio.h> #include<stdlib.h> void main(void) { // locate char infile[20], outfile[20]; gets(infile); gets(outfile); // open FILE *in, *out; in = fopen(infile, "r"); if(in == NULL) printf("error: without infile "); else printf("infile has open. "); out = fopen(outfile, "w"); // operate while(!feof(in)) fputc(fgetc(in), out); // close if(fclose(in) == 0 && fclose(out) == 0) printf("close successfully "); else printf("fclose: error "); return; }
关于文件的概念:
文件的签名,
文件的存储形式,
文件的操作方式。