📄 creator.c
字号:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
void main()
{
FILE *myfile;
char c;
myfile = fopen("alive.txt","r");
if(myfile) //the file exists
{
puts("ALIVE.TXT already exists!");
printf("Overwrite it? [Y/N]");
c = toupper(getchar());
if(c!='Y')
{
puts("Okay. Goodbye");
fclose(myfile);
exit(0);
}
}
myfile = fopen("alive.txt","w");
if(myfile==NULL)
{
puts("Some kind of error");
exit(0);
}
fprintf(myfile,"I created a file! It's alive!");
fclose(myfile);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -