c++标准库头文件
- 格式:docx
- 大小:26.70 KB
- 文档页数:3
标准C语言头文件ISO C标准定义的头文件(24项)<assert。
h> 验证程序断言〈complex。
h〉支持复数算术运算〈ctype。
h〉字符类型<errno。
h〉出错码<fenv。
h> 浮点环境〈float。
h> 浮点常量<inttypes。
h> 整型格式转换〈iso646.h〉替代关系操作符宏〈limits。
h> 实现常量<locale.h〉局部类别<math。
h〉数学常量〈setjmp.h> 非局部goto〈signal。
h> 信号〈stdarg。
h〉可变参数表〈stdbool.h> 布尔类型和值〈stddef。
h> 标准定义〈stdint.h〉整型<stdio。
h〉标准I/O库〈stdlib.h〉实用程序库函数〈string。
h〉字符串操作<tgmath.h〉通用类型数学宏<time.h> 时间和日期〈wchar。
h〉宽字符支持〈wctype.h〉宽字符分类和映射支持POSIX标准定义的必须的头文件(26项)〈dirent.h〉目录项<fcntl.h> 文件控制〈fnmatch。
h> 文件名匹配类型〈glob。
h> 路径名模式匹配类型〈grp。
h> 组文件〈netdb.h> 网络数据库操作〈pwd.h〉口令文件<regex。
h> 正则表达式〈tar。
h> tar归档值<termios。
h> 终端I/O <unistd.h> 符号常量<utime.h〉文件时间<wordexp。
h〉字扩展类型<arpa/inet.h> Internet定义<net/if.h> 套接字本地接口〈netinet/in.h> Internet地址族 <netinet/tcp.h〉传输控制协议〈sys/mman。
c 标准头文件C标准头文件。
C语言是一种通用的高级程序设计语言,它广泛应用于系统软件、应用软件、嵌入式软件、网络软件等领域。
在C语言的编程过程中,标准头文件扮演着非常重要的角色,它们包含了一些常用的函数、宏定义和数据结构,为程序员提供了丰富的工具和资源。
本文将对C标准头文件进行介绍,希望能够对初学者有所帮助。
stdio.h。
stdio.h是C语言标准库中最常用的头文件之一,它包含了C标准输入输出库的函数声明和宏定义。
在stdio.h中定义了一系列用于输入输出的函数,比如printf、scanf、fopen、fclose等,这些函数可以帮助程序员实现对文件的读写操作,以及控制台的输入输出。
除此之外,stdio.h还定义了一些常用的宏,比如NULL、EOF等,它们为程序员提供了方便快捷的编程工具。
stdlib.h。
stdlib.h是C语言标准库中定义了一些通用工具函数的头文件,比如内存分配、随机数生成、字符串转换等。
在实际编程中,程序员经常会用到stdlib.h中的函数,比如malloc、free、rand、atoi等。
这些函数可以帮助程序员实现动态内存分配、随机数生成、字符串转换等功能,为程序的实现提供了方便。
math.h。
math.h是C语言标准库中定义了一些数学函数和常量的头文件,比如三角函数、对数函数、指数函数等。
在实际编程中,程序员经常会用到math.h中的函数,比如sin、cos、log、exp等。
这些函数可以帮助程序员实现各种数学运算,为程序的实现提供了强大的数学支持。
time.h。
time.h是C语言标准库中定义了一些时间函数和数据类型的头文件,比如获取当前时间、时间格式转换、时间延迟等。
在实际编程中,程序员经常会用到time.h 中的函数,比如time、localtime、sleep等。
这些函数可以帮助程序员实现对时间的操作,为程序的实现提供了时间支持。
总结。
C标准头文件是C语言编程中不可或缺的一部分,它们为程序员提供了丰富的工具和资源,帮助程序员实现各种功能和操作。
C语⾔头⽂件#includestdlib.h的作⽤ stdlib 头⽂件即standard library标准库头⽂件 stdlib 头⽂件⾥包含了C、C++语⾔的最常⽤的 该⽂件包含了的C语⾔标准的定义 stdlib.h⾥⾯定义了五种类型、⼀些宏和通⽤⼯具函数。
类型例如、wchar_t、div_t、ldiv_t和lldiv_t;宏例如EXIT_FAILURE、EXIT_SUCCESS、和MB_CUR_MAX等等;常⽤的函数如malloc()、calloc()、realloc()、free()、system()、atoi()、atol()、rand()、srand()、exit()等等。
具体的内容你⾃⼰可以打开的include⽬录⾥⾯的stdlib.h头⽂件看看。
stdlib.h⽤法 1函数名称: calloc 函数原型: void * calloc(unsigned n,unsign size); 函数功能: 分配n个数据项的内存连续空间,每个数据项的⼤⼩为size 函数返回: 分配内存单元的起始地址,如果不成功,返回0 2函数名称: free 函数原型: void free(void* p); 函数功能: 释放p所指的内存区 函数返回: 参数说明: p-被释放的指针 3函数名称: malloc 函数原型: void * malloc(unsigned size); 函数功能: 分配size字节的存储区 函数返回: 所分配的内存区地址,如果内存不够,返回0 4函数名称: realloc 函数原型: void * realloc(void * p,unsigned size); 函数功能: 将p所指出的已分配内存区的⼤⼩改为size,size可以⽐原来分配的空间⼤或⼩ 函数返回: 返回指向该内存区的指针.NULL-分配失败 5函数名称: rand 函数原型: int rand(void); 函数功能: 产⽣0到32767间的随机整数(0到0x7fff之间) 函数返回: 随机整数 6函数名称: abort 函数原型: void abort(void) 函数功能: 异常终⽌⼀个进程. 7函数名称: exit 函数原型: void exit(int state) 函数功能: 程序中⽌执⾏,返回调⽤过程 函数返回: 参数说明: state:0-正常中⽌,⾮0-⾮正常中⽌ 8函数名称: getenv 函数原型: char* getenv(const char *name) 函数功能: 返回⼀个指向环境变量的指针 函数返回: 环境变量的定义 参数说明: name-环境字符串 9函数名称: putenv 函数原型: int putenv(const char *name) 函数功能: 将字符串name增加到DOS环境变量中 函数返回: 0:操作成功,-1:操作失败 参数说明: name-环境字符串 10函数名称: labs 函数原型: long labs(long num) 函数功能: 求长整型参数的 函数返回: 绝对值 11函数名称: atof 函数原型: double atof(char *str) 函数功能: 将字符串转换成⼀个双精度数值 函数返回: 转换后的数值 参数说明: str-待转换浮点型数的字符串 12函数名称: atoi 函数原型: int atoi(char *str) 函数功能: 将字符串转换成⼀个整数值 函数返回: 转换后的数值 参数说明: str-待转换为整型数的字符串 13函数名称: atol 函数原型: long atol(char *str) 函数功能: 将字符串转换成⼀个长整数 函数返回: 转换后的数值 参数说明: str-待转换为长整型的字符串 14函数名称: ecvt 函数原型: char *ecvt(double value,int ndigit,int *dec,int *sign) 函数功能: 将浮点数转换为字符串 函数返回: 转换后的字符串指针 参数说明: value-待转换底浮点数,ndigit-转换后的字符串长度 15函数名称: fcvt 函数原型: char *fcvt(double value,int ndigit,int *dec,int *sign) 函数功能: 将浮点数变成⼀个字符串 函数返回: 转换后字符串指针 参数说明: value-待转换底浮点数,ndigit-转换后底字符串长度。
标准库函数地头文件---------------------------------------------------------------------- 函数头文件----------------------------------------------------------------------abort stdlib.habs stdlib.h acos math.h asctime time.hasin math.h assert assert.hatan math.h atan2 math.h atexit stdlib.hatof stdlib.hatoi stdlib.hatol stdlib.h bsearch stdlib.h BUFSIZ stdio.h calloc stdlib.hceil math.h clearerr stdio.hclock time.h CLOCKS-PER-SEC time.hclock_t time.hcos math.h cosh math.h ctime time.h difftime time.hdiv stdlib.hdiv_t stdlib.h EDOM errno.h EOF stdio.h ERANGE errno.h errno errno.hexit stdlib.h EXIT_FAILURE stdlib.h EXIT_SUCCESS stdlib.hexp math.h fabs math.h fclose stdio.hfeof stdio.h ferror stdio.hfgetc stdio.h fgetpos stdio.h fgets stdio.h FILE stdio.h FILENAME-MAX stdio.h floor math.h fmod math.h fopen stdio.h FOPEN_MAX stdio.h fpos_t stdio.h fpnntf stdio.h fputc stdio.h fputs stdio.h head stdio.h free stdlib.h freopen stdio.h frexp math.h fscanf stdio.h fseek stdio.h fsetpos stdio.h ftell stdio.h fwrite stdio.h getc stdio.h getchar stdio.h getenv stdlib.h gets stdio.h gmtime time.h HUGE-V AL math.h _IOFBF stdio.h _IOLBF stdio.h _IONBF stdio.h isalnum ctype.h isalpha ctype.h iscntrl ctype.h isdigit ctype.h isgraph ctype.h islower ctype.h isprint ctype.h ispunct ctype.h isspace ctype.h isupper ctype.h isxdigit ctype.h jmp_buf setjmp.hLC_ALL locale.hLC_COLLATE locale.hLC_CTYPE locale.hLC_MONETARY locale.hLC_NUMERIC locale.hLC_TIME locale.hstruct lconv locale.hldexp math.hldiv stdlib.hldiv_t stdlib.hlocaleconv locale.hlocaltime timehlog math.hlog10 math.hlongjmp setjmp.hL_tmpnam stdio.hmalloc stdlib.hmblen stdlib.hmbstowcs stdlib.hmbtowc stdlib.hMB_CUR_MAX stdlib.hmemchr string.hmemcmp string.hmemcpy string.hmemmove string.hmemset string.hmktime time.hmodf math.hNDEBUG assert.hNULL locale.h stddef.h stdio.h stdlib.h string.h time.hoffsetof stddef.hperror stdio.hpow math.hprintf stdio.hptrdiff_t stddef.hputc stdio.hputchar stdio.hputs stdio.hqsort stdlib.hraise signal.hrand stdlib.hRAND_MAX stdlib.hremove stdio.hrename stdio.hrewind stdio.hscanf stdio.hSEEK_CUR stdio.hSEEK_END stdio.hSEEK_SET stdio.hsetbuf stdio.hsetjmp setjmp. hsetlocale locale.hsetvbuf stdio.hSIGABRT signal.hSIGFPE signal.hSIGILL signal.hSIGINT signal.hsignal signal.hSIGSEGV signal.hSIGTERM signal.hsig_atomic_t signal.hSIG_DFL signal.hSIG_ERR signal.hSIG_IGN signal.hsin math.hsinh math.hsize_t stddef.h stdlib.h string.hsprintf stdio.hsqrt math.hsrand stdlib.hsscanf stdio.hstderr stdio.hstdin stdio.hstdout stdio.hstrcat string.hstrchr string.hstrcmp string.hstrcoll string.hstrcpy string.hstrcspn string.hstrerror string.hstrftime time.hstrlen string.hstrncat string.hstrncpy string.h strpbrk string.h strrchr string.h strspn string.h strstr string.h strtod stdlib.h strtok string.h strtol stdlib.h strtoul stdlib.h strxfrm string.h system stblib.h tan math.h tanh math.h time time.h time_t time.h struct tm time.h tmpfile stdio.h tmpnam stdio.h TMP_MAX stdio.h tolower ctype.h toupper ctype.h ungetc stdio.h va_arg stdarg.h va_end stdarg.h valist stdarg.h va_ start stdarg.h vfprintf stdio.h vprintf stdio.h vsprintf stdio.h wchar_t stddef.h. wcstombs stdlib.h wctomb stdlib.h----------------------------------------------------版权申明本文部分内容,包括文字、图片、以及设计等在网上搜集整理.版权为个人所有This article includes some parts, including text, pictures, and design. Copyright is personal ownership.用户可将本文地内容或服务用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律地规定,不得侵犯本网站及相关权利人地合法权利.除此以外,将本文任何内容或服务用于其他用途时,须征得本人及相关权利人地书面许可,并支付报酬.Users may use the contents or services of this article for personal study, research or appreciation, and othernon-commercial or non-profit purposes, but at the same time, they shall abide by the provisions of copyright law and other relevant laws, and shall not infringe upon the legitimate rights of this website and its relevant obligees. In addition, when any content or service of this article is used for other purposes, written permission and remuneration shall be obtained from the person concerned and the relevant obligee.转载或引用本文内容必须是以新闻性或资料性公共免费信息为使用目地地合理、善意引用,不得对本文内容原意进行曲解、修改,并自负版权等法律责任.Reproduction or quotation of the content of this article must be reasonable and good-faith citation for the use of news or informative public free information. It shall not misinterpret or modify the original intention of the content of this article, and shall bear legal liability such as copyright.。
c语⾔_头⽂件_stdlib简介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()、srand()、exit()等等。
具体的内容你⾃⼰可以打开编译器的include⽬录⾥⾯的stdlib.h头⽂件看看。
内容1/*****stdlib.h - declarations/definitions for commonly used library functions** Copyright (c) Microsoft Corporation. All rights reserved.**Purpose:* This include file contains the function declarations for commonly* used library functio 2#if _MSC_VER > 1000#pragma once#endif3 #ifndef _INC_STDLIB#define _INC_STDLIB4 #include <crtdefs.h>#include <limits.h>5 #ifdef _MSC_VER/** * Currently, all MS C compilers for Win32 platforms default to 8 byte * alignment. */#pragma pack(push,_CRT_PACKING)#endif /** _MSC_VER */6 #ifdef __cplusplusextern "C" {#endif7/** Define NULL pointer value */#ifndef NULL#ifdef __cplusplus#define NULL 0#else#define NULL ((void *)0)#endif#endif8/** Definition of the argument values for the exit() function */9#define EXIT_SUCCESS 0#define EXIT_FAILURE 110 #ifndef _ONEXIT_T_DEFINED11#if !defined (_M_CEE_PURE) || (_MSC_VER < 1400)typedef int (__cdecl * _onexit_t)(void);#elsetypedef int (__clrcall * _onexit_t)(void);typedef _onexit_t _onexit_m_t;#endif12#if defined (_M_CEE_MIXED) && (_MSC_VER >= 1400)typedef int (__clrcall * _onexit_m_t)(void);#endif13#if !__STDC__/** Non-ANSI name for compatibility */#define onexit_t _onexit_t#endif14#define _ONEXIT_T_DEFINED#endif15/** Data structure definitions for div and ldiv runtimes. */16 #ifndef _DIV_T_DEFINED17 typedef struct _div_t { int quot; int rem;} div_t;18 typedef struct _ldiv_t { long quot; long rem;} ldiv_t;19#define _DIV_T_DEFINED#endif20/** * structs used to fool the compiler into not generating floating point * instructions when copying and pushing [long] double values */21 #ifndef _CRT_DOUBLE_DEC22 #ifndef _LDSUPPORT23#pragma pack(4)typedef struct { unsigned char ld[10];} _LDOUBLE;#pragma pack()24#define _PTR_LD(x) ((unsigned char *)(&(x)->ld))25#else26/** push and pop long, which is #defined as __int64 by a spec2k test */#pragma push_macro("long")#undef longtypedef long double _LDOUBLE;#pragma pop_macro("long")27#define _PTR_LD(x) ((unsigned char *)(x))28#endif29 typedef struct { double x;} _CRT_DOUBLE;30 typedef struct { float f;} _CRT_FLOAT;31/** push and pop long, which is #defined as __int64 by a spec2k test */#pragma push_macro("long")#undef long32 typedef struct { /** * Assume there is a long double type */long double x;} _LONGDOUBLE;33#pragma pop_macro("long")34#pragma pack(4)typedef struct { unsigned char ld12[12];} _LDBL12;#pragma pack()35#define _CRT_DOUBLE_DEC#endif36/** Maximum value that can be returned by the rand function. */37#define RAND_MAX 0x7fff38/** * Maximum number of bytes in multi-byte character in the current locale * (also defined in ctype.h). */#ifndef MB_CUR_MAX#if defined (_MT) && (defined (_M_CEE_PURE))#define MB_CUR_MAX ___mb_cur_max_func()#else#define MB_ 39/** Minimum and maximum macros */40#define __max(a,b) (((a) > (b)) ? (a) : (b))#define __min(a,b) (((a) < (b)) ? (a) : (b))41/** * Sizes for buffers used by the _makepath() and _splitpath() functions. * note that the sizes include space for 0-terminator */#define _MAX_PATH 260 /** max. length of full pathname */#define _MAX_DRIVE 3 /** max. length of drive c 42/** * Argument values for _set_error_mode(). */#define _OUT_TO_DEFAULT 0#define _OUT_TO_STDERR 1#define _OUT_TO_MSGBOX 2#define _REPORT_ERRMODE 343/** * Argument values for _set_abort_behavior(). */#define _WRITE_ABORT_MSG 0x1#define _CALL_REPORTFAULT 0x244/** * Sizes for buffers used by the getenv/putenv family of functions. */#define _MAX_ENV 3276745/** External variable declarations */#ifndef _CRT_ERRNO_DEFINED#define _CRT_ERRNO_DEFINED#ifdef _NTSUBSET_extern int errno;#else /** _NTSUBSET_ */_CRTIMP extern int * __cdecl _errno(void);#define errno (*_errno())46 errno_t __cdecl _set_errno(__in int _Value);errno_t __cdecl _get_errno(__out int * _Value);47#endif /** _NTSUBSET_ */#endif /** _CRT_ERRNO_DEFINED */48 #ifndef _NTSUBSET__CRTIMP unsigned long * __cdecl __doserrno(void);#define _doserrno (*__doserrno())49 errno_t __cdecl _set_doserrno(__in unsigned long _Value);errno_t __cdecl _get_doserrno(__out unsigned long * _Value);#endif /** _NTSUBSET_ */50#define _CRT_SYS_ERR_DATA51 #ifndef _CRT_SYS_ERR_DATA52/** you can't modify this, but it is non-const for backcompat */_CRTIMP _CRT_INSECURE_DEPRECATE(strerror) char ** __cdecl __sys_errlist(void);#define _sys_errlist (__sys_errlist())53 _CRTIMP _CRT_INSECURE_DEPRECATE(strerror) int * __cdecl __sys_nerr(void);#define _sys_nerr (*__sys_nerr())54#else /** _CRT_SYS_ERR_DATA */55 #ifndef _M_CEE_PURE56 _CRTIMP _CRT_INSECURE_DEPRECATE(strerror) extern char const * const _sys_errlist[]; /** perror error message table */_CRTIMP _CRT_INSECURE_DEPRECATE(strerror) extern const int _sys_nerr; /** # of entries in sys_errlis 57#endif58#endif /** _CRT_SYS_ERR_DATA */59#if defined(_DLL) && defined(_M_IX86)60 _CRTIMP int * __cdecl __p___argc(void);_CRTIMP char *** __cdecl __p___argv(void);_CRTIMP wchar_t *** __cdecl __p___wargv(void);_CRTIMP char *** __cdecl __p__environ(void);_CRTIMP wchar_t *** __cdecl __p__w 61#endif /** _M_IX86 && _DLL */62#if !defined(_M_CEE_PURE)_CRTIMP extern int __argc; /** count of cmd line args */_CRTIMP extern char ** __argv; /** pointer to table of cmd line args */_CRTIMP extern wchar_t ** __wargv; /** pointer to table of wide cmd line ar63 _CRTIMPerrno_t__cdecl_get_environ( __out char*** Value );64 _CRTIMPerrno_t__cdecl_get_wenviron( __out wchar_t*** Value );65#if !defined(_M_CEE_PURE)_CRTIMP extern char ** _environ; /** pointer to environment table */_CRTIMP extern wchar_t ** _wenviron; /** pointer to wide environment table */66 _CRT_INSECURE_DEPRECATE_GLOBALS(_get_pgmptr) _CRTIMP extern char * _pgmptr; /** points to the module (EXE) name */_CRT_INSECURE_DEPRECATE_GLOBALS(_get_wpgmptr) _CRTIMP extern wchar_t * _wpgmptr;67#else68 _CRTIMP char*** __cdecl __p__environ();_CRTIMP wchar_t*** __cdecl __p__wenviron();_CRT_INSECURE_DEPRECATE_GLOBALS(_get_pgmptr) _CRTIMP char** __cdecl __p__pgmptr();_CRT_INSECURE_DEPRECATE_GLOBALS(_get_ 69#define _environ (*__p__environ())#define _wenviron (*__p__wenviron())#define _pgmptr (*__p__pgmptr())#define _wpgmptr (*__p__wpgmptr())70#endif /** !defined(_M_CEE_PURE) */71 errno_t __cdecl _get_pgmptr(__deref_out_z char ** _Value);errno_t __cdecl _get_wpgmptr(__deref_out_z wchar_t ** _Value);72#if !defined(_M_CEE_PURE)_CRT_INSECURE_DEPRECATE_GLOBALS(_get_fmode) _CRTIMP extern int _fmode; /** default file translation mode */#else_CRTIMP int* __cdecl __p__fmode();#define _fmode (*__p__fmode())#endif /** 73 _CRTIMP errno_t __cdecl _set_fmode(__in int _Mode);_CRTIMP errno_t __cdecl _get_fmode(__out int * _PMode);74#if !defined(_M_CEE_PURE) __declspec(deprecated) _CRTIMP extern int _fileinfo; /** open file info mode (for spawn) */#endif /** !defined(_M_CEE_PURE) */__declspec(deprecated) errno_t __cdecl _set_fileinfo(int);__declspec(deprecate 75/** Windows major/minor and O.S. version numbers */76#pragma warning(push)#pragma warning(disable:4141)77#if !defined(_M_CEE_PURE)_CRT_INSECURE_DEPRECATE(_get_osplatform) _CRT_OBSOLETE(GetVersionEx) _CRTIMP extern unsigned int _osplatform;_CRT_INSECURE_DEPRECATE(_get_osver) _CRT_OBSOLETE(GetVersionEx) 78 #else_CRT_INSECURE_DEPRECATE(_get_osplatform) _CRT_OBSOLETE(GetVersionEx) _CRTIMP unsigned int* __cdecl __p__osplatform();_CRT_INSECURE_DEPRECATE(_get_osver) _CRT_OBSOLETE(GetVersionEx) _CRTIMP uns 79#define _osplatform (*__p__osplatform())#define _osver (*__p__osver())#define _winver (*__p__winver())#define _winmajor (*__p__winmajor())#define _winminor (*__p__winminor())#endif /** !defined(_M_CEE_PURE) */80#pragma warning(pop)81 _CRT_OBSOLETE(GetVersionEx) errno_t __cdecl _get_osplatform(__out unsigned int * _Value);_CRT_OBSOLETE(GetVersionEx) errno_t __cdecl _get_osver(__out unsigned int * _Value);_CRT_OBSOLETE(GetVersionEx) errno_t __cdecl _ 82/** _countof helper */#if !defined(_countof)#if !defined(__cplusplus)#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))#elseextern "C++"{template <typename _CountofType, size_t _SizeOfArray>char (*__countof_helper(UNALIGNED 83/** function prototypes */84 #ifndef _CRT_TERMINATE_DEFINED#define _CRT_TERMINATE_DEFINED_CRTIMP __declspec(noreturn) void __cdecl exit(__in int _Code);_CRTIMP __declspec(noreturn) void __cdecl _exit(__in int _Code);_CRTIMP void __cdecl abort(v85 _CRTIMP unsigned int __cdecl _set_abort_behavior(__in unsigned int _Flags, __in unsigned int _Mask);86 #ifndef _CRT_ABS_DEFINED#define _CRT_ABS_DEFINED int __cdecl abs(__in int _X); long __cdecl labs(__in long _X);#endif87#if _INTEGRAL_MAX_BITS >= 64 __int64 __cdecl _abs64(__int64);#endif#if _MSC_VER >= 1400 && defined(_M_CEE) __checkReturn int __clrcall _atexit_m_appdomain(__in_opt void (__clrcall * _Func)(void));#if defined(_M 88#if __STDC_WANT_SECURE_LIB___CRTIMP_ALT void __cdecl qsort_s(__inout_bcount(_NumOfElements* _SizeOfElements) void * _Base, __in rsize_t _NumOfElements, __in rsize_t _SizeOfElements, __in int (__cdecl * _PtFu89 _CRTIMP __checkReturn_opt errno_t __cdecl _mbstowcs_s_l(__out_opt size_t * _PtNumOfCharConverted, __out_ecount_part_opt(_SizeInWords, *_PtNumOfCharConverted) wchar_t * _DstBuf, __in size_t _SizeInWords, __in_ecount_z(_Ma90 _CRTIMP __checkReturn int __cdecl rand(void);#if defined(_CRT_RAND_S)_CRTIMP errno_t __cdecl rand_s ( __out unsigned int *_RandomValue);#endif91 _CRTIMP __checkReturn_opt int __cdecl _set_error_mode(__in int _Mode);92 _CRTIMP void __cdecl srand(__in unsigned int _Seed);_CRTIMP __checkReturn double __cdecl strtod(__in_z const char * _Str, __deref_opt_out_z char ** _EndPtr);_CRTIMP __checkReturn double __cdecl _strtod_l(__in_z const93#if _MSC_VER >= 1400 && defined(__cplusplus) && defined(_M_CEE)/** * Managed search routines. Note __cplusplus, this is because we only support * managed C++. */extern "C++"{#if __STDC_WANT_SECURE_LIB____checkReturn vo 94#if __STDC_WANT_SECURE_LIB__void __clrcall qsort_s(__inout_bcount(_NumOfElements*_SizeOfElements) void * _Base, __in rsize_t _NumOfElements, __in rsize_t _SizeOfElements, __in int (__clrcall * _PtFuncCompare)(void *, c95 #ifndef _CRT_ALLOCATION_DEFINED#define _CRT_ALLOCATION_DEFINED_CRTIMP _CRT_JIT_INTRINSIC _CRTNOALIAS _CRTRESTRICT __checkReturn __bcount_opt(_NumOfElements* _SizeOfElements) void * __cdecl calloc(_96 #ifndef _WSTDLIB_DEFINED97/** wide function prototypes, also declared in wchar.h */98 _CRTIMP_ALT __checkReturn_wat errno_t __ALTDECL _itow_s (__in int _Val, __out_ecount_z(_SizeInWords) wchar_t * _DstBuf, __in size_t _SizeInWords, __in int _Radix);__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(errno_t, _itow 99#if _INTEGRAL_MAX_BITS >= 64_CRTIMP_ALT __checkReturn_wat errno_t __ALTDECL _i64tow_s(__in __int64 _Val, __out_ecount_z(_SizeInWords) wchar_t * _DstBuf, __in size_t _SizeInWords, __in int _Radix);_CRTIMP _CRT_INSE 100#define _WSTDLIB_DEFINED#endif101/** Buffer size required to be passed to _gcvt, fcvt and other fp conversion routines*/#define _CVTBUFSIZE (309+40) /** # of digits in max. dp value + slop */102#if (defined(_DEBUG) || defined(_SYSCRT_DEBUG)) && defined(_CRTDBG_MAP_ALLOC)#pragma push_macro("_fullpath")#undef _fullpath#endif103 _CRTIMP __checkReturn char * __cdecl _fullpath(__out_ecount_z_opt(_SizeInBytes) char * _FullPath, __in_z const char * _Path, __in size_t _SizeInBytes);104#if (defined(_DEBUG) || defined(_SYSCRT_DEBUG)) && defined(_CRTDBG_MAP_ALLOC)#pragma pop_macro("_fullpath")#endif105 _CRTIMP_ALT __checkReturn_wat errno_t __cdecl _ecvt_s(__out_ecount_z(_Size) char * _DstBuf, __in size_t _Size, __in double _Val, __in int _NumOfDights, __out int * _PtDec, __out int * _PtSign);__DEFINE_CPP_OVERLOAD_SECUR 106 _CRTIMP __checkReturn int __cdecl _atodbl(__out _CRT_DOUBLE * _Result, __in_z char * _Str);_CRTIMP __checkReturn int __cdecl _atoldbl(__out _LDOUBLE * _Result, __in_z char * _Str);_CRTIMP __checkReturn int __cdecl _atoflt(__ 107#if _MSC_VER >= 1400 && defined(_M_CEE) _onexit_m_t __clrcall _onexit_m_appdomain(_onexit_m_t _Function); #if defined(_M_CEE_MIXED) _onexit_m_t __clrcall _onexit_m(_onexit_m_t _Function); #else inline _onexit_m_t __ 108 _CRT_INSECURE_DEPRECATE(_splitpath_s) _CRTIMP void __cdecl _splitpath(__in_z const char * _FullPath, __out_z_opt char * _Drive, __out_z_opt char * _Dir, __out_z_opt char * _Filename, __out_z_opt char * _Ext);_CRTIMP_ALT _ 109 _CRTIMP void __cdecl _swab(__inout_ecount_full(_SizeInBytes) char * _Buf1, __inout_ecount_full(_SizeInBytes) char * _Buf2, int _SizeInBytes);110 #ifndef _WSTDLIBP_DEFINED111/** wide function prototypes, also declared in wchar.h */112#if (defined(_DEBUG) || defined(_SYSCRT_DEBUG)) && defined(_CRTDBG_MAP_ALLOC)#pragma push_macro("_wfullpath")#undef _wfullpath#endif113 _CRTIMP __checkReturn wchar_t * __cdecl _wfullpath(__out_ecount_z_opt(_SizeInWords) wchar_t * _FullPath, __in_z const wchar_t * _Path, __in size_t _SizeInWords);114#if (defined(_DEBUG) || defined(_SYSCRT_DEBUG)) && defined(_CRTDBG_MAP_ALLOC)#pragma pop_macro("_wfullpath")#endif115 _CRTIMP_ALT __checkReturn_wat errno_t __ALTDECL _wmakepath_s(__out_ecount_z(_SizeInWords) wchar_t * _PathResult, __in_opt size_t _SizeInWords, __in_z_opt const wchar_t * _Drive, __in_z_opt const wchar_t * _Dir, __in_z_opt 116#define _WSTDLIBP_DEFINED#endif117/** The Win32 API SetErrorMode, Beep and Sleep should be used instead. */_CRT_OBSOLETE(SetErrorMode) _CRTIMP void __cdecl _seterrormode(__in int _Mode);_CRT_OBSOLETE(Beep) _CRTIMP void __cdecl _beep(__in unsigned _F 118#if !__STDC__119/** Non-ANSI names for compatibility */120 #ifndef __cplusplus#define max(a,b) (((a) > (b)) ? (a) : (b))#define min(a,b) (((a) < (b)) ? (a) : (b))#endif121#define sys_errlist _sys_errlist#define sys_nerr _sys_nerr#define environ _environ122#pragma warning(push)#pragma warning(disable: 4141) /** Using deprecated twice */ _CRT_NONSTDC_DEPRECATE(_ecvt) _CRT_INSECURE_DEPRECATE(_ecvt_s) _CRTIMP __checkReturn char * __cdecl ecvt(__in double _Val, __in in 123#endif /** __STDC__ */124 #ifdef __cplusplus}125#endif126 #ifdef _MSC_VER#pragma pack(pop)#endif /** _MSC_VER */127#endif /** _INC_STDLIB *//** 88bf0570-3001-4e78-a5f2-be5765546192 */View Code包含的函数输⼊样式:C语⾔模式:#include <stdlib.h>C++样式:#include <cstdlib>1函数名称:calloc函数原型: void * calloc(unsigned n,unsigned size);函数功能: 分配n个数据项的内存连续空间,每个数据项的⼤⼩为size函数返回: 分配内存单元的起始地址,如果不成功,返回02函数名称:free函数原型: void free(void* p);函数功能: 释放p所指的内存区函数返回:参数说明: p-被释放的指针3函数名称:malloc函数原型: void * malloc(unsigned size);函数功能: 分配size字节的存储区函数返回: 所分配的内存区地址,如果内存不够,返回04函数名称: realloc函数原型: void * realloc(void * p,unsigned size);函数功能: 将p所指出的已分配内存区的⼤⼩改为size,size可以⽐原来分配的空间⼤或⼩函数返回: 返回指向该内存区的指针.NULL-分配失败5函数名称: rand函数原型: int rand(void);函数功能: 产⽣0到32767间的随机整数(0到0x7fff之间)函数返回: 随机整数6函数名称: abort函数原型: void abort(void)函数功能: 异常终⽌⼀个进程.7函数名称: exit函数原型: void exit(int state)函数功能: 程序中⽌执⾏,返回调⽤过程函数返回:参数说明: state:0-正常中⽌,⾮0-⾮正常中⽌8函数名称: getenv函数原型: char* getenv(const char *name)函数功能: 返回⼀个指向环境变量的指针函数返回:环境变量的定义参数说明: name-环境字符串9函数名称: putenv函数原型: int putenv(const char *name)函数功能: 将字符串name增加到DOS环境变量中函数返回: 0:操作成功,-1:操作失败参数说明: name-环境字符串10函数名称: labs函数原型: long labs(long num)函数功能: 求长整型参数的绝对值函数返回:绝对值11函数名称: atof函数原型: double atof(char *str)函数功能: 将字符串转换成⼀个双精度数值函数返回: 转换后的数值参数说明: str-待转换浮点型数的字符串12函数名称: atoi函数原型: int atoi(char *str)函数功能: 将字符串转换成⼀个整数值函数返回: 转换后的数值参数说明: str-待转换为整型数的字符串13函数名称: atol函数原型: long atol(char *str)函数功能: 将字符串转换成⼀个长整数函数返回: 转换后的数值参数说明: str-待转换为长整型的字符串14函数名称:ecvt函数原型: char *ecvt(double value,int ndigit,int *dec,int *sign)函数功能: 将浮点数转换为字符串函数返回: 转换后的字符串指针参数说明: value-待转换底浮点数,ndigit-转换后的字符串长度15函数名称:fcvt函数原型: char *fcvt(double value,int ndigit,int *dec,int *sign)函数功能: 将浮点数变成⼀个字符串函数返回: 转换后字符串指针参数说明: value-待转换底浮点数,ndigit-转换后底字符串长度。
c语言stdio.h读法
C语言中的<stdio.h>是C标准库中的一个头文件,它提供了许多用于输入和输出的函数和宏定义。
在C语言中,头文件通常用于包含函数原型和宏定义,以便在程序中使用这些函数和宏而无需重新编写代码。
在<stdio.h>头文件中,包含了诸如printf、scanf、fopen、fclose等函数的原型和相关的宏定义。
这些函数和宏定义提供了C 语言中进行输入和输出操作所需的基本功能。
通过包含<stdio.h>头文件,程序员可以在自己的程序中使用这些函数和宏,从而实现对文件、标准输入和标准输出的操作。
另外,<stdio.h>中还包含了一些特定的数据类型和常量,比如FILE类型和相关的常量(如stdin、stdout、stderr等),这些在文件操作中非常有用。
总的来说,<stdio.h>是C语言中非常重要的一个头文件,它为程序员提供了丰富的输入输出函数和宏定义,使得C语言能够方便地进行各种输入输出操作。
在编写C语言程序时,通常需要包含这个头文件以便使用其中提供的函数和宏定义。
标准C语言头文件ISO C标准定义的头文件(24项)<assert.h> 验证程序断言<complex.h> 支持复数算术运算<ctype.h> 字符类型<errno.h> 出错码<fenv.h> 浮点环境<float.h> 浮点常量<inttypes.h> 整型格式转换<iso646.h> 替代关系操作符宏<limits.h> 实现常量<locale.h> 局部类别<math.h> 数学常量<setjmp.h> 非局部goto<signal.h> 信号<stdarg.h> 可变参数表<stdbool.h> 布尔类型和值<stddef.h> 标准定义<stdint.h> 整型<stdio.h> 标准I/O库<stdlib.h> 实用程序库函数<string.h> 字符串操作<tgmath.h> 通用类型数学宏<time.h> 时间和日期<wchar.h> 宽字符支持<wctype.h> 宽字符分类和映射支持POSIX标准定义的必须的头文件(26项)<dirent.h> 目录项<fcntl.h> 文件控制<fnmatch.h> 文件名匹配类型<glob.h> 路径名模式匹配类型<grp.h> 组文件<netdb.h> 网络数据库操作<pwd.h> 口令文件<regex.h> 正则表达式<tar.h> tar归档值<termios.h> 终端I/O <unistd.h> 符号常量<utime.h> 文件时间<wordexp.h> 字扩展类型<arpa/inet.h> Internet定义<net/if.h> 套接字本地接口<netinet/in.h> Internet地址族 <netinet/tcp.h> 传输控制协议<sys/mman.h> 内存管理声明<sys/select.h> select函数<sys/socket.h> 套接字接口<sys/stat.h> 文件状态<sys/times.h> 进程时间<sys/types.h> 基本系统数据类型<sys/un.h> UNIX域套接字定义<sys/utsname.h>系统名<sys/wait.h> 进程控制POSIX标准定义的XSI扩展头文件(26项)<cpio.h> cpio归档值<dlfcn.h> 动态链接<fmtmsg.h> 消息显示结构<ftw.h> 文件树漫游<iconv.h> 代码集转换实用程序<langinfo.h> 语言信息常量<libgen.h> 模式匹配函数定义<monetary.h> 货币类型<ndbm.h> 数据库操作<nl_types.h> 消息类别<poll.h> 轮询函数<search.h> 搜索表<strings.h> 字符串操作<syslog.h> 系统出错日志记录<ucontext.h> 用户上下文<ulimit.h> 用户限制<utmpx.h> 用户帐户数据库<sys/ipc.h> IPC<sys/msg.h> 消息队列<sys/resource.h> 资源操作<sys/sem.h> 信号量<sys/shm.h> 共享存储<sys/statvfs.h> 文件系统信息<sys/time.h> 时间类型<sys/timeb.h> 附加的时间<sys/uio.h> 矢量I/O操作POSIX标准定义的可选头文件(8项)<aio.h> 异步I/O <mqueue.h> 消息队列<pthread.h> 线程<sched.h> 执行调度<semaphore.h> 信号量<spawn.h> 实时spawn接口<stropts.h> XSI STREAMS接口<trace.h> 时间跟踪标准 C++ 语言头文件(54个其中16个用于构建STL,3个为附加非必须)<algorithm>STL通用算法<bitset> STL位集容器<cassert> 用于在程序运行时执行断言<cctype> 字符处理<cerrno> 错误码<cfloat> 用于测试浮点类型属性<ciso646> ISO646变体字符集<climits> 测试整数类型属性<clocale> 本地化函数<cmath> 数学函数<complex>复数类<csetjmp> 执行非内部的goto语句<csignal> 信号<cstdarg> 访问参数数量变化的函数<cstddef> 用于定义实用的类型和宏<cstdio> 输入/输出<cstdlib> 杂项函数及内存分配<cstring> 字符串<ctime> 时间<cwchar> 宽字符处理及输入/输出<cwctype> 宽字符分类<deque> STL双端队列容器<exception> 异常处理类<fstream> 文件流<functional> STL函数对象<iomanip> 参数化输入/输出<ios>基本输入/输出支持<iosfwd> 输入/输出前置声明<iostream> 数据流输入/输出<istream> 基本输入流<iterator> 遍历序列的类<limits> 各种数据类型最值常量<list>STL线性列表容器<locale> 国际化支持<map> STL映射容器<memory> 专用内存分配器<new> 基本内存分配和释放<numeric> 通用的数字操作<ostream> 基本输出流<queue> STL 队列容器<set> STL 集合容器<sstream> 基于字符串的流<stack> STL 堆栈容器<stdexcept> 标准异常类<streambuf> iostream 的缓冲区类<string> 字符串类<strstream> 非内存字符序列的流类<typeinfo> 运行时类型标识<utility> STL 通用模板类<valarray> 支持值数组的类和模版类<vector> STL 动态数组容器标准C++附加的头文件(3个)非必须<hash_map> <hash_set> <slist>The Standard C++ library consists of 51 required headers.This implementation also includes three additional headers,<hash_map>,<hash_set>,and <slist>,not required by the C++ Standard,for a total of 54 headers.Of these 54 headers,16 constitute the Standard Template Library,or STL.These are indicated below with the notation<algorithm> -- (STL) for defining numerous templates that implement useful algorithms<bitset> -- for defining a template class that administers sets of bits<complex> -- for defining a template class that supports complex arithmetic<deque> -- (STL) for defining a template class that implements a deque container<exception> -- for defining several functions that control exception handling<fstream> -- for defining several iostreams template classes that manipulate exteral files<functional>-- (STL) for defining several templates that help construct predicates for the templates defined in <algorithm> and <numeric><hash_map> -- (STL) for defining template classes that implement hashed associative containersthat map keys to values<hash_set> -- (STL) for defining template classes that implement hashed associative containers<iomanip> -- for declaring several iostreams manipulators that take an argument<ios> -- for defining the template class that serves as the base for many iostreams classes<iosfwd> -- for declaring several iostreams template classes before they are necessarilydefined<iostream> -- for declaring the iostreams objects that manipulate the standard streams<istream> -- for defining the template class that performs extractions<iterator> -- (STL) for defining several templates that help define and manipulate iterators<limits> -- for testing numeric type properties<list>-- (STL) for defining a template class that implements a doubly linked list container<locale> -- for defining several classes and templates that controllocale-specific behavior, as in the iostreams classes<map>-- (STL) for defining template classes that implement associative containers thatmap keys to values<memory>-- (STL) for defining several templates that allocate and free storage for variouscontainer classes<new> -- for declaring several functions that allocate and free storage<numeric>-- (STL) for defining several templates that implement useful numeric functions<ostream> -- for defining the template class that performs insertions<queue> -- (STL) for defining a template class that implements a queue container<set>-- (STL) for defining template classes that implement associative containers<slist>-- (STL) for defining a template class that implements a singly linked list container<sstream> -- for defining several iostreams template classes that manipulate string containers<stack> -- (STL) for defining a template class that implements a stack container<stdexcept> -- for defining several classes useful for reporting exceptions<streambuf> -- for defining template classes that buffer iostreams operations<string> -- for defining a template class that implements a string container<strstream> -- for defining several iostreams classes that manipulate in-memory character sequences<typeinfo> -- for defining class type_info, the result of the typeid operator<utility>-- (STL) for defining several templates of general utility<valarray> -- for defining several classes and template classes that support value-oriented arrays<vector>-- (STL) for defining a template class that implements a vector container新的C标准库<cassert> -- for enforcing assertions when functions execute<cctype> -- for classifying characters<cerrno> -- for testing error codes reported by library functions<cfloat> -- for testing floating-point type properties<ciso646> -- for programming in ISO 646 variant character sets<climits> -- for testing integer type properties<clocale> -- for adapting to different cultural conventions<cmath> -- for computing common mathematical functions<csetjmp> -- for executing nonlocal goto statements<csignal> -- for controlling various exceptional conditions<cstdarg> -- for accessing a varying number of arguments<cstddef> -- for defining several useful types and macros<cstdio> -- for performing input and output<cstdlib> -- for performing a variety of operations<cstring> -- for manipulating several kinds of strings<ctime> -- for converting between various time and date formats<cwchar> -- for manipulating wide streams and several kinds of strings<cwctype> -- for classifying wide characters旧的C标准库<assert.h> -- for enforcing assertions when functions execute<ctype.h> -- for classifying characters<errno.h> -- for testing error codes reported by library functions<float.h> -- for testing floating-point type properties<iso646.h> -- for programming in ISO 646 variant character sets<limits.h> -- for testing integer type properties<locale.h> -- for adapting to different cultural conventions<math.h> -- for computing common mathematical functions<setjmp.h> -- for executing nonlocal goto statements<signal.h> -- for controlling various exceptional conditions<stdarg.h> -- for accessing a varying number of arguments<stddef.h> -- for defining several useful types and macros<stdio.h> -- for performing input and output<stdlib.h> -- for performing a variety of operations<string.h> -- for manipulating several kinds of strings<time.h> -- for converting between various time and date formats<wchar.h> -- for manipulating wide streams and several kinds of strings<wctype.h> -- for classifying wide charactersFinally, in this implementation, the Standard C++ library also includes several headers for compatibility with traditional C++ libraries:<fstream.h> -- for defining several iostreams template classes that manipulate exteral files <iomanip.h> -- for declaring several iostreams manipulators that take an argument<iostream.h> -- for declaring the iostreams objects that manipulate the standard streams <new.h> -- for declaring several functions that allocate and free storage<stl.h> -- for declaring several template classes that aid migration from older versions of the Standard Template Library。
目录•介绍:什么是C语言标准库和头文件•标准库的分类•常用的C语言标准库•<stdio.h>:输入输出函数库•<stdlib.h>:常用函数库•<string.h>:字符串处理函数库•<math.h>:数学计算函数库•<time.h>:时间日期函数库•头文件的作用•如何包含头文件•头文件保护•总结介绍C语言是一种广泛应用于系统开发和嵌入式编程的编程语言。
在C语言的发展过程中,为了提高程序开发效率和代码重用性,C语言标准库和头文件应运而生。
本文将介绍C语言的标准库和头文件的基本知识。
标准库的分类C语言标准库可以分为两类:系统提供的标准库和用户自定义的标准库。
系统提供的标准库是C语言编译器自带的,可以直接使用。
系统提供的标准库包含了很多常用的函数,例如用于输入输出操作的函数、处理字符串的函数、进行数学计算的函数等。
用户自定义的标准库是开发人员根据自己的需求编写的库。
用户自定义的标准库可以提供一些特定领域的函数和数据结构,以便在程序中进行重用,提高代码的可维护性和可读性。
常用的C语言标准库以下是一些常用的C语言标准库及其功能的介绍。
<stdio.h>:输入输出函数库<stdio.h>是C语言的标准输入输出函数库,提供了对文件的读写操作、控制台输入输出等功能。
常用函数包括printf、scanf、fopen、fclose等。
<stdlib.h>:常用函数库<stdlib.h>提供了一些常用的函数,包括内存分配和释放函数、字符串转换函数、随机数生成函数等。
常用函数包括malloc、free、atoi、rand等。
<string.h>:字符串处理函数库<string.h>提供了一些字符串操作的函数,如字符串拷贝、字符串连接、字符串比较等。
常用函数包括strcpy、strcat、strcmp等。
c语言标准库的实现C语言标准库的实现。
C语言标准库是C语言程序设计中非常重要的一部分,它提供了丰富的函数和宏定义,可以帮助程序员轻松地完成各种任务。
在本文中,我们将深入探讨C语言标准库的实现原理,帮助读者更好地理解C语言标准库的内部机制。
C语言标准库包括多个头文件,每个头文件中包含了一组相关的函数和宏定义。
这些头文件通常以“.h”为后缀,比如stdio.h、stdlib.h等。
C语言标准库的实现通常分为两部分,用户空间部分和内核空间部分。
用户空间部分是C语言标准库的主要实现,它包含了大部分标准库函数的实现代码。
这些函数通常是由C语言编写的,可以直接被应用程序调用。
在用户空间部分,标准库函数通常是通过系统调用来实现各种功能,比如文件操作、内存管理、字符串处理等。
内核空间部分是C语言标准库的底层实现,它包含了一些与操作系统相关的函数和宏定义。
这些函数通常是由操作系统内核提供的,可以直接被用户空间部分调用。
在内核空间部分,标准库函数通常是通过系统调用和内核接口来实现各种功能,比如进程管理、线程管理、文件系统操作等。
C语言标准库的实现通常是由编译器厂商提供的,不同的编译器厂商可能会有不同的实现方式。
但是,无论是哪种实现方式,C语言标准库都必须遵循C语言标准的规范,确保在不同的平台上都能够正常运行。
在实际编程中,我们经常会用到C语言标准库中的各种函数和宏定义,比如printf、scanf、malloc、free等。
这些函数和宏定义在C语言标准库的实现中起着非常重要的作用,它们可以帮助程序员轻松地完成各种任务,提高程序的可移植性和可维护性。
总的来说,C语言标准库的实现是C语言程序设计中非常重要的一部分,它提供了丰富的函数和宏定义,可以帮助程序员轻松地完成各种任务。
通过深入探讨C 语言标准库的实现原理,我们可以更好地理解C语言标准库的内部机制,为我们编写高质量的C语言程序提供帮助。
C++标准库头文件介绍
C++标准库的所有头文件都没有扩展名。
C++标准库的内容总共在50个标准头文件中定义,其中18个提供了C库的功能。
<cname>形式的标准头文件【<complex>例外】其内容与ISO 标准C包含的name.h头文件相同,但容纳了C++扩展的功能。
在<cname>形式标准的头文件中,与宏相关的名称在全局作用域中定义,其他名称在std命名空间中声明。
在C++中还可以使用name.h形式的标准C库头文件名。
C++标准库的内容分为10类:
C1.语言支持C2.输入/输出C3.诊断C4.一般工具C5.字符串
C6.容器C7.迭代器支持C8.算法C9.数值操作C10.本地化
C1 标准库中与语言支持功能相关的头文件头文件描述
<cstddef>定义宏NULL和offsetof,以及其他标准类型size_t和ptrdiff_t。
与对应的标准C头文件的区别是,NULL是C++空指针常量的补充定义,宏offsetof接受结构或者联合类型参数,只要他们没有成员指针类型的非静态成员即可。
<limits>提供与基本数据类型相关的定义。
例如,对于每个数值数据类型,它定义了可以表示出来的最大值和最小值以及二进制数字的位数。
<climits>提供与基本整数数据类型相关的C样式定义。
这些信息的C++样式定义在<limits>中<cfloat>提供与基本浮点型数据类型相关的C样式定义。
这些信息的C++样式定义在<limits>中
<cstdlib>提供支持程序启动和终止的宏和函数。
这个头文件还声明了许多其他杂项函数,例如搜索和排序函数,从字符串转换为数值等函数。
它与对应的标准C头文件stdlib.h不同,定义了abort(void)。
abort()函数还有额外的功能,它不为静态或自动对象调用析构函数,也不调用传给atexit()函数的函数。
它还定义了exit()函数的额外功能,可以释放静态对象,以注册的逆序调用用atexit()注册的函数。
清除并关闭所有打开的C流,把控制权返回给主机环境。
<new>支持动态内存分配
<typeinfo>支持变量在运行期间的类型标识
<exception>支持异常处理,这是处理程序中可能发生的错误的一种方式
<cstdarg>支持接受数量可变的参数的函数。
即在调用函数时,可以给函数传送数量不等的数据项。
它定义了宏va_arg、va_end、va_start以及va_list类型
<csetjmp>为C样式的非本地跳跃提供函数。
这些函数在C++中不常用
<csignal>为中断处理提供C样式支持
C2 支持流输入/输出的头文件头文件描述
<iostream>支持标准流cin、cout、cerr和clog的输入和输出,它还支持多字节字符标准流wcin、wcout、wcerr和wclog。
<iomanip>提供操纵程序,允许改变流的状态,从而改变输出的格式。
<ios>定义iostream的基类
<istream>为管理输出流缓存区的输入定义模板类
<ostream>为管理输出流缓存区的输出定义模板类
<sstream>支持字符串的流输入输出
<fstream>支持文件的流输入输出
<iosfwd>为输入输出对象提供向前的声明
<streambuf>支持流输入和输出的缓存
<cstdio>为标准流提供C样式的输入和输出
<cwchar>支持多字节字符的C样式输入输出
C3 与诊断功能相关的头文件头文件描述
<stdexcept>定义标准异常。
异常是处理错误的方式
<cassert>定义断言宏,用于检查运行期间的情形
<cerrno>支持C样式的错误信息
C4 定义工具函数的头文件头文件描述
<utility>定义重载的关系运算符,简化关系运算符的写入,它还定义了pair类型,该类型是一种模板类型,可以存储一对值。
这些功能在库的其他地方使用
<functional>定义了许多函数对象类型和支持函数对象的功能,函数对象是支持operator()()函数调用运算符的任意对象
<memory>给容器、管理内存的函数和auto_ptr模板类定义标准内存分配器
<ctime>支持系统时钟函数
C5 支持字符串处理的头文件头文件描述
<string>为字符串类型提供支持和定义,包括单字节字符串(由char组成)的string和多字节字符串(由wchar_t组成)
<cctype>单字节字符类别
<cwctype>多字节字符类别
<cstring>为处理非空字节序列和内存块提供函数。
这不同于对应的标准C库头文件,几个C 样式字符串的一般C库函数被返回值为const和非const的函数对替代了
<cwchar>为处理、执行I/O和转换多字节字符序列提供函数,这不同于对应的标准C库头文件,几个多字节C样式字符串操作的一般C库函数被返回值为const和非const的函数对替代了。
<cstdlib>为把单字节字符串转换为数值、在多字节字符和多字节字符串之间转换提供函数
C6 定义容器类的模板的头文件头文件描述
<vector>定义vector序列模板,这是一个大小可以重新设置的数组类型,比普通数组更安全、更灵活
<list>定义list序列模板,这是一个序列的链表,常常在任意位置插入和删除元素
<deque>定义deque序列模板,支持在开始和结尾的高效插入和删除操作
<queue>为队列(先进先出)数据结构定义序列适配器queue和priority_queue
<stack>为堆栈(后进先出)数据结构定义序列适配器stack
<map> map是一个关联容器类型,允许根据键值是唯一的,且按照升序存储。
multimap类似于map,但键不是唯一的。
<set> set是一个关联容器类型,用于以升序方式存储唯一值。
multiset类似于set,但是值不必是唯一的。
<bitset>为固定长度的位序列定义bitset模板,它可以看作固定长度的紧凑型bool数组
C7 支持迭代器的头文件头文件描述
<iterator>给迭代器提供定义和支持
C8 有关算法的头文件头文件描述
<algorithm>提供一组基于算法的函数,包括置换、排序、合并和搜索
<cstdlib>声明C标准库函数bsearch()和qsort(),进行搜索和排序
<ciso646>允许在代码中使用and代替&&
C9 有关数值操作的头文件头文件描述
<complex>支持复杂数值的定义和操作
<valarray>支持数值矢量的操作
<numeric>在数值序列上定义一组一般数学操作,例如accumulate和inner_product <cmath>这是C数学库,其中还附加了重载函数,以支持C++约定
<cstdlib>提供的函数可以提取整数的绝对值,对整数进行取余数操作
C10 有关本地化的头文件头文件描述
<locale>提供的本地化包括字符类别、排序序列以及货币和日期表示。
<clocale>对本地化提供C样式支持
本文来自CSDN博客,转载请标明出处:
/v2sun/archive/2009/08/08/4424953.aspx。