收藏 分享(赏)

stdlib.h 标准库头文件.doc

上传人:HR专家 文档编号:11431259 上传时间:2020-04-27 格式:DOC 页数:14 大小:96KB
下载 相关 举报
stdlib.h 标准库头文件.doc_第1页
第1页 / 共14页
stdlib.h 标准库头文件.doc_第2页
第2页 / 共14页
stdlib.h 标准库头文件.doc_第3页
第3页 / 共14页
stdlib.h 标准库头文件.doc_第4页
第4页 / 共14页
stdlib.h 标准库头文件.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

1、stdlib.h 标准库头文件一、 简介stdlib 头文件即standard library标准库头文件 stdlib 头文件里包含了C、C+语言的最常用的系统函数 该文件包含了的C语言标准库函数的定义 stdlib.h里面定义了五种类型、一些宏和通用工具函数。 类型例如size_t、wchar_t、div_t、ldiv_t和lldiv_t; 宏例如EXIT_FAILURE、EXIT_SUCCESS、RAND_MAX和MB_CUR_MAX等等; 常用的函数如malloc()、calloc()、realloc()、free()、system()、atoi()、atol()、rand()、sra

2、nd()、exit()等等。二、 Stdlib.H具体内容/*stdlib.h - declarations/definitions for commonly used library functions* Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.*Purpose:* This include file contains the function declarations for commonly* used library functions which either dont fit somew

3、here else, or,* cannot be declared in the normal place for other reasons.* ANSI* Public*/#if _MSC_VER 1000#pragma once#endif /* _MSC_VER 1000 */#ifndef _INC_STDLIB#define _INC_STDLIB#if !defined (_WIN32) & !defined (_MAC)#error ERROR: Only Mac or Win32 targets supported!#endif /* !defined (_WIN32) &

4、 !defined (_MAC) */#ifndef _CRTBLD/* This version of the header files is NOT for user programs. * It is intended for use when building the C runtimes ONLY. * The version intended for public use will not have this message. */#error ERROR: Use of C runtime library internal header file.#endif /* _CRTBL

5、D */#ifdef _MSC_VER/* * Currently, all MS C compilers for Win32 platforms default to 8 byte * alignment. */#pragma pack(push,8)#endif /* _MSC_VER */#ifdef _cplusplusextern C #endif /* _cplusplus */#ifndef _INTERNAL_IFSTRIP_#include #endif /* _INTERNAL_IFSTRIP_ */* Define _CRTIMP */#ifndef _CRTIMP#if

6、def CRTDLL#define _CRTIMP _declspec(dllexport)#else /* CRTDLL */#ifdef _DLL#define _CRTIMP _declspec(dllimport)#else /* _DLL */#define _CRTIMP#endif /* _DLL */#endif /* CRTDLL */#endif /* _CRTIMP */* Define _cdecl for non-Microsoft compilers */#if (!defined (_MSC_VER) & !defined (_cdecl)#define _cde

7、cl#endif /* (!defined (_MSC_VER) & !defined (_cdecl) */* Define _CRTAPI1 (for compatibility with the NT SDK) */#ifndef _CRTAPI1#if _MSC_VER = 800 & _M_IX86 = 300#define _CRTAPI1 _cdecl#else /* _MSC_VER = 800 & _M_IX86 = 300 */#define _CRTAPI1#endif /* _MSC_VER = 800 & _M_IX86 = 300 */#endif /* _CRTA

8、PI1 */#ifndef _SIZE_T_DEFINEDtypedef unsigned int size_t;#define _SIZE_T_DEFINED#endif /* _SIZE_T_DEFINED */#ifndef _WCHAR_T_DEFINEDtypedef unsigned short wchar_t;#define _WCHAR_T_DEFINED#endif /* _WCHAR_T_DEFINED */* Define NULL pointer value */#ifndef NULL#ifdef _cplusplus#define NULL 0#else /* _c

9、plusplus */#define NULL (void *)0)#endif /* _cplusplus */#endif /* NULL */* Definition of the argument values for the exit() function */#define EXIT_SUCCESS 0#define EXIT_FAILURE 1#ifndef _ONEXIT_T_DEFINEDtypedef int (_cdecl * _onexit_t)(void);#if !_STDC_/* Non-ANSI name for compatibility */#define

10、onexit_t _onexit_t#endif /* !_STDC_ */#define _ONEXIT_T_DEFINED#endif /* _ONEXIT_T_DEFINED */* Data structure definitions for div and ldiv runtimes. */#ifndef _DIV_T_DEFINEDtypedef struct _div_t int quot; int rem; div_t;typedef struct _ldiv_t long quot; long rem; ldiv_t;#define _DIV_T_DEFINED#endif

11、/* _DIV_T_DEFINED */* Maximum value that can be returned by the rand function. */#define RAND_MAX 0x7fff/* * Maximum number of bytes in multi-byte character in the current locale * (also defined in ctype.h). */#ifndef MB_CUR_MAX#ifndef _INTERNAL_IFSTRIP_#if defined (_DLL) & defined (_M_IX86)/* Retai

12、ned for compatibility with VC+ 5.0 and earlier versions */_CRTIMP int * _cdecl _p_mb_cur_max(void);#endif /* defined (_DLL) & defined (_M_IX86) */#endif /* _INTERNAL_IFSTRIP_ */#define MB_CUR_MAX _mb_cur_max_CRTIMP extern int _mb_cur_max;#endif /* MB_CUR_MAX */* Minimum and maximum macros */#define

13、_max(a,b) (a) (b) ? (a) : (b)#define _min(a,b) (a) = 1200_CRTIMP _declspec(noreturn) void _cdecl abort(void);_CRTIMP _declspec(noreturn) void _cdecl exit(int);#else /* _MSC_VER = 1200 */_CRTIMP void _cdecl abort(void);_CRTIMP void _cdecl exit(int);#endif /* _MSC_VER = 1200 */#if defined (_M_MRX000)_

14、CRTIMP int _cdecl abs(int);#else /* defined (_M_MRX000) */ int _cdecl abs(int);#endif /* defined (_M_MRX000) */ int _cdecl atexit(void (_cdecl *)(void);_CRTIMP double _cdecl atof(const char *);_CRTIMP int _cdecl atoi(const char *);_CRTIMP long _cdecl atol(const char *);#ifdef _M_M68K_CRTIMP long dou

15、ble _cdecl _atold(const char *);#endif /* _M_M68K */_CRTIMP void * _cdecl bsearch(const void *, const void *, size_t, size_t, int (_cdecl *)(const void *, const void *);_CRTIMP void * _cdecl calloc(size_t, size_t);_CRTIMP div_t _cdecl div(int, int);_CRTIMP void _cdecl free(void *);_CRTIMP char * _cd

16、ecl getenv(const char *);_CRTIMP char * _cdecl _itoa(int, char *, int);#if _INTEGRAL_MAX_BITS = 64 _CRTIMP char * _cdecl _i64toa(_int64, char *, int);_CRTIMP char * _cdecl _ui64toa(unsigned _int64, char *, int);_CRTIMP _int64 _cdecl _atoi64(const char *);#endif /* _INTEGRAL_MAX_BITS = 64 */#if defin

17、ed (_M_MRX000)_CRTIMP long _cdecl labs(long);#else /* defined (_M_MRX000) */ long _cdecl labs(long);#endif /* defined (_M_MRX000) */_CRTIMP ldiv_t _cdecl ldiv(long, long);_CRTIMP char * _cdecl _ltoa(long, char *, int);_CRTIMP void * _cdecl malloc(size_t);_CRTIMP int _cdecl mblen(const char *, size_t

18、);_CRTIMP size_t _cdecl _mbstrlen(const char *s);_CRTIMP int _cdecl mbtowc(wchar_t *, const char *, size_t);_CRTIMP size_t _cdecl mbstowcs(wchar_t *, const char *, size_t);_CRTIMP void _cdecl qsort(void *, size_t, size_t, int (_cdecl *) (const void *, const void *);_CRTIMP int _cdecl rand(void);_CRT

19、IMP void * _cdecl realloc(void *, size_t);_CRTIMP int _cdecl _set_error_mode(int);_CRTIMP void _cdecl srand(unsigned int);_CRTIMP double _cdecl strtod(const char *, char *);_CRTIMP long _cdecl strtol(const char *, char *, int);#ifdef _M_M68K_CRTIMP long double _cdecl _strtold(const char *, char *);#

20、endif /* _M_M68K */_CRTIMP unsigned long _cdecl strtoul(const char *, char *, int);#ifndef _MAC_CRTIMP int _cdecl system(const char *);#endif /* _MAC */_CRTIMP char * _cdecl _ultoa(unsigned long, char *, int);_CRTIMP int _cdecl wctomb(char *, wchar_t);_CRTIMP size_t _cdecl wcstombs(char *, const wch

21、ar_t *, size_t);#ifndef _MAC#ifndef _WSTDLIB_DEFINED/* wide function prototypes, also declared in wchar.h */_CRTIMP wchar_t * _cdecl _itow (int, wchar_t *, int);_CRTIMP wchar_t * _cdecl _ltow (long, wchar_t *, int);_CRTIMP wchar_t * _cdecl _ultow (unsigned long, wchar_t *, int);_CRTIMP double _cdecl

22、 wcstod(const wchar_t *, wchar_t *);_CRTIMP long _cdecl wcstol(const wchar_t *, wchar_t *, int);_CRTIMP unsigned long _cdecl wcstoul(const wchar_t *, wchar_t *, int);_CRTIMP wchar_t * _cdecl _wgetenv(const wchar_t *);_CRTIMP int _cdecl _wsystem(const wchar_t *);_CRTIMP int _cdecl _wtoi(const wchar_t

23、 *);_CRTIMP long _cdecl _wtol(const wchar_t *);#if _INTEGRAL_MAX_BITS = 64 _CRTIMP wchar_t * _cdecl _i64tow(_int64, wchar_t *, int);_CRTIMP wchar_t * _cdecl _ui64tow(unsigned _int64, wchar_t *, int);_CRTIMP _int64 _cdecl _wtoi64(const wchar_t *);#endif /* _INTEGRAL_MAX_BITS = 64 */#define _WSTDLIB_D

24、EFINED#endif /* _WSTDLIB_DEFINED */#endif /* _MAC */_CRTIMP char * _cdecl _ecvt(double, int, int *, int *);#if _MSC_VER = 1200_CRTIMP _declspec(noreturn) void _cdecl _exit(int);#else /* _MSC_VER = 1200 */_CRTIMP void _cdecl _exit(int);#endif /* _MSC_VER = 1200 */_CRTIMP char * _cdecl _fcvt(double, i

25、nt, int *, int *);_CRTIMP char * _cdecl _fullpath(char *, const char *, size_t);_CRTIMP char * _cdecl _gcvt(double, int, char *); unsigned long _cdecl _lrotl(unsigned long, int); unsigned long _cdecl _lrotr(unsigned long, int);#ifndef _MAC_CRTIMP void _cdecl _makepath(char *, const char *, const cha

26、r *, const char *, const char *);#endif /* _MAC */ _onexit_t _cdecl _onexit(_onexit_t);_CRTIMP void _cdecl perror(const char *);_CRTIMP int _cdecl _putenv(const char *); unsigned int _cdecl _rotl(unsigned int, int); unsigned int _cdecl _rotr(unsigned int, int);_CRTIMP void _cdecl _searchenv(const ch

27、ar *, const char *, char *);#ifndef _MAC_CRTIMP void _cdecl _splitpath(const char *, char *, char *, char *, char *);#endif /* _MAC */_CRTIMP void _cdecl _swab(char *, char *, int);#ifndef _MAC#ifndef _WSTDLIBP_DEFINED/* wide function prototypes, also declared in wchar.h */_CRTIMP wchar_t * _cdecl _

28、wfullpath(wchar_t *, const wchar_t *, size_t);_CRTIMP void _cdecl _wmakepath(wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *);_CRTIMP void _cdecl _wperror(const wchar_t *);_CRTIMP int _cdecl _wputenv(const wchar_t *);_CRTIMP void _cdecl _wsearchenv(const wchar_t *, cons

29、t wchar_t *, wchar_t *);_CRTIMP void _cdecl _wsplitpath(const wchar_t *, wchar_t *, wchar_t *, wchar_t *, wchar_t *);#define _WSTDLIBP_DEFINED#endif /* _WSTDLIBP_DEFINED */#endif /* _MAC */* - The following functions are OBSOLETE - */* The Win32 API SetErrorMode, Beep and Sleep should be used instea

30、d. */#ifndef _MAC_CRTIMP void _cdecl _seterrormode(int);_CRTIMP void _cdecl _beep(unsigned, unsigned);_CRTIMP void _cdecl _sleep(unsigned long);#endif /* _MAC */* - The preceding functions are OBSOLETE - */#if !_STDC_/* - The declarations below should not be in stdlib.h - */* - and will be removed in a future release. Include - */* - ctype.h to obtain these declarations. - */#ifndef tolower_CRTIMP int _cdecl tolower(int);#endif /* tolower */#ifndef toupper_CRTIMP int _cdecl toupper(int);#endif /* toupper */* - The declarations above will be r

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 规范标准 > 国内外标准规范

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报