⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 creator.c

📁 C.Game.Programming.For.Dummies.原码
💻 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 + -