It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center




已关闭8年。




我的C程序生成此数据。我需要将其放入CSV文件中,以便其他程序可以使用它。我怎样才能做到这一点?
Student1 Mark1 Mark2 Mark3 Mark4 Mark5
Student2 Mark1 Mark2 Mark3 Mark4 Mark5
Student3 Mark1 Mark2 Mark3 Mark4 Mark5
Student4 Mark1 Mark2 Mark3 Mark4 Mark5
Student5 Mark1 Mark2 Mark3 Mark4 Mark5

最佳答案

您可以通过fprintf实现

for(i = 0; i < num_of_students; i++)
     fprintf(fptr, "%s,%d,%d,%d,%d,%d\n", name, mark1, mark2, mark3, mark4, mark5);

关于c - 用C写入CSV文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14916527/

10-11 15:45