#include <stdio.h>
int fputc(int c, FILE *stream);
int fputs(const char *s, FILE *stream);
int putc(int c, FILE *stream);
int putchar(int c);
int puts(const char *s);
#include <stdio.h>
int main()
{
FILE *fp;
char writeBuff[] = "hello world";
fp = fopen("a.c","w+");
if(fp == NULL){
printf("open file failed \n");
return -1;
}
fputs(writeBuff,fp);
fclose(fp);
return 0;
}
运行结果