#include <stdio.h>
/**
* @brief 文件操作,将参数写入到文件中
* @param write data_1 data_2 data_3
* @param filename file's path and name
* @retval None
*/
void WriteIn_Params(double data_1,double data_2,double data_3,char* filename)
{
//file point
FILE *fp;
//get file operate error handle
int nResult;
fp = fopen(filename, "a+"); //新建文本文件并追加数据
if (NULL == fp)
{
printf("Open file error\n");
}
//write in
nResult = fprintf(fp, "%f %f %f\n", data_1,data_2,data_3);
//Write data failed
if (nResult < 0)
{
printf("Write data to file error\n");
}
printf("Write formatted data to file completely\n");
//close the file and delet the point
fclose(fp);
}