读书人

资料追加

发布时间: 2012-11-22 00:16:41 作者: rapoo

文件追加

#include <stdio.h>int main(){FILE *fpSrc=NULL;FILE *fpDst=NULL;//char ch;char srcFilename[20]="src.txt";char dstFilename[20]="dst.txt";if ((fpSrc=fopen(srcFilename,"r"))==NULL){printf("Can't open the source file!\n");exit(0);}if ((fpDst=fopen(dstFilename,"a"))==NULL){printf("Can't open the destination file !\n");exit(0);}while(!feof(fpSrc)){fputc(fgetc(fpSrc),fpDst);}fflush(fpDst); if (fpSrc!=NULL){fclose(fpSrc);}if (fpDst!=NULL){fclose(fpDst);}        return 0;} 

读书人网 >编程

热点推荐