vs中用fopen_s打开文件,如何将数组数据导入文件
FILE *fp1_u; errno_t err1_u;
err1_u = fopen_s(&fp1_u, "C:\\Users\owner chen\Documents\EX\t1_u.txt", "w");
fprintf(fp1_u, "时间步长:0.1\n");
fprintf(fp1_u, "迭代步数");
for (int i = 0; i < 10; i++)
fprintf(fp1_u, "%d ", i);
fprintf(fp1_u, "\n");
fprintf(fp1_u, "u的数值解");
for (int i = 0; i < 10; i++)
fprintf(fp1_u, "%f ", u[0][i]);
fprintf(fp1_u, "\n");
fprintf(fp1_u, "u的精确解(sin(ft))");
for (int i = 0; i < 10; i++)
fprintf(fp1_u, "%f ", u0[0][i]);
fprintf(fp1_u, "\n");
fprintf(fp1_u, "误差");
for (int i = 0; i < 10; i++)
fprintf(fp1_u, "%f ", r_u[0][i]);
fprintf(fp1_u, "\n");
fprintf(fp1_u, "误差比");
for (int i = 0; i < 10; i++)
fprintf(fp1_u, "%f ", err_u[0][i] * 100);
fprintf(fp1_u, "\n");
fprintf(fp1_u, "累积误差");
for (int i = 0; i < 10; i++)
r = r + r_u[0][i];
fprintf(fp1_u, "%f ", r);
fprintf(fp1_u, "\n");
程序如上,运行到fprintf语句时,会出现:将一个无效参数传递给了将无效参数视为严重错误的函数 的错误。因为使用vs编的只能用fopen_s,请教各位我该如何把文件指针正确指向目标文件,已达到导出的目的。