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

📄 genlib.c

📁 c语言开发方面的经典问题,包括源代码.c语言开发所要注意的问题,以及在嵌入式等各方面的应用
💻 C
字号:
/* * File: genlib.c * Version: 1.0 * Last modified on Fri Jul 15 15:45:52 1994 by eroberts * ----------------------------------------------------- * This file implements the general C library package.  See the * interface description in genlib.h for details. */#include <stdio.h>#include <stddef.h>#include <string.h>#include <stdarg.h>#include "genlib.h"/* * Constants: * ---------- * ErrorExitStatus -- Status value used in exit call */#define ErrorExitStatus 1/* Section 1 -- Define new "primitive" types *//* * Constant: UNDEFINED * ------------------- * This entry defines the target of the UNDEFINED constant. */char undefined_object[] = "UNDEFINED";/* Section 2 -- Memory allocation */void *GetBlock(size_t nbytes){    void *result;    result = malloc(nbytes);    if (result == NULL) Error("No memory available");    return (result);}void FreeBlock(void *ptr){    free(ptr);}/* Section 3 -- Basic error handling */void Error(string msg, ...){    va_list args;    va_start(args, msg);    fprintf(stderr, "Error: ");    vfprintf(stderr, msg, args);    fprintf(stderr, "\n");    va_end(args);    exit(ErrorExitStatus);}

⌨️ 快捷键说明

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