#include<stdio.h>
int main()
{
int age=0;
FILE *file =NULL;
file=fopen("test.txt","r+");
//rename("test.txt","xinhai.txt");
if(file!=NULL)
{
printf("The file can be opened.");
fputc('A',file);
fputc('\n',file);
fputs("come on",file);
printf("您多少岁?\n");
scanf("%d",&age);
fprintf(file,"使用者年龄是%d岁",age);
fclose(file);
}
else
{
printf("The file can't be opened.");
}
remove("test.txt");
return 0;
}
C语言文件读写
最新推荐文章于 2024-09-30 12:31:31 发布