70,035
社区成员
发帖
与我相关
我的任务
分享#include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 3;
int b = 4;
FILE* fp;
if ((fp=fopen("answer.txt", "w+")) == NULL) {
printf("file open error.\n");
abort();
}
fprintf(fp, "The answer is %d.\n", a*b);
fclose(fp);
return 0;
}#include <stdio.h>
void main() {
int a,b,s;
FILE *p;
a=3;b=4;
s=a*b;
p=fopen("answer.txt","w");
fprintf(p,"The answer is %d.",s);
fclose(p);
}
fputs("Hello");
fprintf("Hello\n");FILE *p = fopen("d:\\1.txt","w+");
char buf[] = "The answer is ***.";
fwrite(buf, strlen(buf),1, p );
fclose(p);