#include<stdio.h>
int main()
{
FILE *opening;
opening = fopen("hello.usr","w");
fprintf(opening,"Hello world!");
fclose(opening);
printf("Writing to the file was successful.\n");
printf("Closing the program");
return 0;
}
我试过用c语言编写一个文件,并写下“HelloWorld!”在里面这个密码怎么了?
最佳答案
如果您想知道是什么问题,请检查fopen
的结果
opening = fopen("hello.usr","w");
if (opening == NULL) {
perror("fopen");
}