-2
出于某种原因,我的代码不会在我的文件上输出任何内容。 下面是相关的代码。如果你需要我提供更多,请说出来。文件上没有输出
//Opening file
fopen("output.txt", "w");
if (output_Ptr == NULL)
{
printf("\n Output file could not be opened.\n");
exit(-1);
}
else
{
fprintf(output_Ptr, "Solution vector\n");
for (i = 0; i < n; i++)
{
fprintf(output_Ptr, "x[%d]=%10.5f\n", i, x[i]);
}
fprintf(output_Ptr, "\n");
}
fclose(output_Ptr);
//free memory
for (i = 0; i < n; i++) {
free(a[i]);
}
free(a);
free(b);
free(x);
return 0;
}
我该怎么办呢?第一次,对不起。 –
@David_red你用我写的代码更新你的代码。你没有看到与你的问题中的代码有什么不同? – jdarthenay
非常抱歉。昨晚没有睡觉。谢谢。 –