首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

资料追加

2012-11-22 
文件追加#include stdio.hint main(){FILE *fpSrcNULLFILE *fpDstNULL//char chchar srcFilename[2

文件追加

#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;} 

热点排行