标签:int else alt birt 练习 oid app 字符 stdio.h
#include<stdio.h>
#include<windows.h>
int main(void){
FILE*data;
data=fopen("C:\\teacher.txt","a");//"a"尾部追加一个“写”的功能
if(!data){ //!data等效于 data == NULL
printf("打开文失败!\n");
return 1;
}else{
printf("文件打开成功,可写入!\n");
}
fputs("Happy birthdy!\n",data);//向文件写入一个字符串
system("pause");
fclose(data);
printf("文件已关闭!\n");
system("pause");
return 0;
}
标签:int else alt birt 练习 oid app 字符 stdio.h
原文地址:https://www.cnblogs.com/fzhiyaoy/p/10403688.html