编写程序,实现以写模式在磁盘上新建一个文件,然后用fputs函数往该文件写入数据,最后关闭文件。
#include <stdio.h>
int main()
{
FILE *fp = fopen("test.txt","w");
if(fp == NULL)
printf("error");
else
{
fputs("hello world",fp);
fclose(fp);
}
return 0;
}