以附加方式打开文件,输入数据,关闭文件。
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fp = NULL;
fp = fopen("test.txt","a+");
if(fp == NULL)
{
printf("cannot open file");
return -;
}
char c[]="22.33,42";
char d[] = {'','','.','','',',','',''};
fprintf(fp, "%s\n",c);
fprintf(fp,"%s\n",d);
fclose(fp);
fp = NULL;
return ; }