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

📄 base2.c

📁 linux下的C语言开发
💻 C
字号:
/******************************************************** * Database -- A very simple database program to        * *              lookup names in a hardcoded list.       * *                                                      * * Usage:                                               * *      database [-S<file>]                             * *                                                      * *      -S<file>        Specify save file for           * *                      debugging purposes              * *                                                      * *              Program will ask you for a name.        * *              Enter the name; it will tell you if     * *              it is the list.                         * *                                                      * *              A blank name terminates the program.    * ********************************************************/#include <stdio.h>#include <stdlib.h>FILE *save_file = NULL; /* Save file if any */char *extended_fgets(char *, int, FILE *);int main(int argc, char *argv[]){    char name[80];      /* a name to lookup */    char *save_file_name; /* Name of the save file */    int lookup(char const *const name); /* lookup a name */    while ((argc > 1) && (argv[1][0] == '-')) {        switch (argv[1][1]) {	    /* -S<file>  Specify a save file */            case 'S':                save_file_name = &argv[1][2];                save_file = fopen(save_file_name, "w");                if (save_file == NULL)                     fprintf(stderr,                        "Warning:Unable to open save file %s\n",                        save_file_name);                break;            default:                fprintf(stderr,"Bad option: %s\n", argv[1]);                exit (8);        }        --argc;        ++argv;    }        while (1) {        printf("Enter name: ");        extended_fgets(name, sizeof(name), stdin);        /* ... Rest of program ... */    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -