资料追加

文件追加
#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;
}