1. 标准C函数库头文件
| 名字 | 源自 | 描述 |
|---|
| <assert.h> | | 包含断言宏,被用来在程序的调试版本中帮助检测逻辑错误以及其他类型的bug。 |
| <complex.h> | C99 | 一组操作复数的函数。 |
| <ctype.h> | | 定义了一组函数,用来根据类型来给字符分类,或者进行大小写转换,而不关心所使用的字符集(通常是ASCII或其扩展字符集,也有EBCDIC)。 |
| <errno.h> | | 用来测试由库函数报的错误代码。 |
| <fenv.h> | C99 | 定义了一组用来控制浮点数环境的函数。 |
| <float.h> | | 定义指定浮点数特定于实现的特性的宏常量。 |
| <inttypes.h> | C99 | 定义精确的宽度整数类型。 |
| <iso646.h> | NA1 | 定义几个等同于C中某些运算符的宏。用于ISO 646变体字符集编程。 |
| <limits.h> | | 定义指定整数类型特定于实现的特性的宏常量。 |
| <locale.h> | | 定义C语言本地化函数。 |
| <math.h> | | 定义C语言数学函数。 |
| <setjmp.h> | | 定义了宏setjmp和longjmp,在非局部跳转的时候使用。 |
| <signal.h> | | 定义C语言信号处理函数。 |
| <stdalign.h> | C11 | 用于查询和指定对象的数据结构对齐方式。 |
| <stdarg.h> | | 用于访问传递给函数的不同数量的参数。 |
| <stdatomic.h> | C11 | 对于线程之间共享数据的原子操作。 |
| <stdbool.h> | C99 | 定义布尔数据类型。 |
| <stddef.h> | | 定义了几个常见的类型与宏。 |
| <stdint.h> | C99 | 定义精确的宽度整数类型。 |
| <stdio.h> | | 定义输入输出函数。 |
| <stdlib.h> | | 定义数值转换函数,伪随机数生成函数,动态内存分配函数,过程控制函数。 |
| <stdnoreturn.h> | C11 | 用于指定非返回函数。 |
| <string.h> | | 定义C语言字符串处理函数。 |
| <tgmath.h> | C99 | 定义类型通用数学函数。 |
| <threads.h> | C11 | 定义用于管理多个线程以及互斥锁和条件变量的函数。 |
| <time.h> | | 定义日期和时间处理功能 |
| <uchar.h> | C11 | 用于操作Unicode字符的类型和函数。 |
| <wchar.h> | NA1 | 定义宽字符串处理函数。 |
| <wctype.h> | NA1 | 定义用于按类型对宽字符进行分类或在大小写之间进行转换的函数集 |
2. 不在标准C函数库中的POSIX标准库头文件
| 头文件 | 描述 | 首次发布 |
|---|
| <aio.h> | 异步I/O | Issue 5 |
| <arpa/inet.h> | 操纵数值IP地址的函数胡 (部分Berkeley套接字) | Issue 6 |
| <cpio.h> | 用于cpio的文件格式#Magic number | Issue 3 |
| <dirent.h> | 打开与列出目录. | Issue 2 |
| <dlfcn.h> | 动态链接 | Issue 5 |
| <fcntl.h> | 文件打开、加锁等操作 | Issue 1 |
| <fmtmsg.h> | Message显示结构 | Issue 4 |
| <fnmatch.h> | 文件名匹配 | Issue 4 |
| <ftw.h> | 文件树遍历 | Issue 1 |
| <glob.h> | 路径名模式匹配Glob | Issue 4 |
| <grp.h> | 用户Group identifier (Unix)信息与控制。 | Issue 1 |
| <iconv.h> | 字符编码转换 | Issue 4 |
| <langinfo.h> | 语言信息常量。建于Locale.h之上。 | Issue 2 |
| <libgen.h> | 路径名操作 | Issue 4 |
| <monetary.h> | 货币单位的字符串格式化 | Issue 4 |
| <mqueue.h> | 消息队列 | Issue 5 |
| <ndbm.h> | NDBM数据库操作 | Issue 4 |
| <net/if.h> | 本地网络接口列表 | Issue 6 |
| <netdb.h> | 把本地协议与主机名翻译为数值地址。是Berkeley套接字的一部分 | Issue 6 |
| <netinet/in.h> | 定义互联网协议与地址族。是Berkeley套接字的一部分 | Issue 6 |
| <netinet/tcp.h> | 额外的TCP的控制选项。是Berkeley套接字的一部分 | Issue 6 |
| <nl_types.h> | 本体化消息分类函数 | Issue 2 |
| <poll.h> | 异步多任务文件描述符 | Issue 4 |
| <pthread.h> | POSIX线程. | Issue 5 |
| <pwd.h> | passwd文件访问与控制 | Issue 1 |
| <regex.h> | 正则表达式 | Issue 4 |
| <sched.h> | 执行调度 | Issue 5 |
| <search.h> | 搜索表 | Issue 1 |
| <semaphore.h> | POSIX 信号量 | Issue 5 |
| <spawn.h> | spawning子进程 | Issue 6 |
| <strings.h> | 大小写不敏感字符串比较 | Issue 4 |
| <stropts.h> | 流操作,包括ioctl | Issue 4 |
| <sys/ipc.h> | 进程间通信 (IPC). | Issue 2 |
| <sys/mman.h> | 内存管理,包括POSIX 共享内存 (进程间通信)与内存映射文件 | Issue 4 |
| <sys/msg.h> | POSIX 消息队列。 | Issue 2 |
| <sys/resource.h> | 资源使用,优先级与限制。 | Issue 4 |
| <sys/select.h> | Select (Unix) | Issue 6 |
| <sys/sem.h> | XSI (SysV风格的) 信号量 | Issue 2 |
| <sys/shm.h> | XSI (SysV风格的)共享内存 (进程间通信) | Issue 2 |
| <sys/socket.h> | Berkley套接字主要头文件 | Issue 6 |
| <sys/stat.h> | 文件信息(stat (Unix)等) | Issue 1 |
| <sys/statvfs.h> | 文件系统信息 | Issue 4 |
| <sys/time.h> | 时间与日期函数与结构 | Issue 4 |
| <sys/times.h> | 文件访问与修改时间 | Issue 1 |
| <sys/types.h> | 不同的数据类型 | Issue 1 |
| <sys/uio.h> | 向量I/O操作 | Issue 4 |
| <sys/un.h> | Unix域套接字 | Issue 6 |
| <sys/utsname.h> | 操作系统信息,包括uname | Issue 1 |
| <sys/wait.h> | 终止子进程的状态(见wait (Unix)) | Issue 3 |
| <syslog.h> | syslog系统日志 | Issue 4 |
| <tar.h> | tar文件格式的Magic number | Issue 3 |
| <termios.h> | 允许串口界面 | Issue 3 |
| <trace.h> | 运行时行为追踪(过时) | Issue 6 |
| <ulimit.h> | 资源限制(被<sys/resource.h>代替) | Issue 1 |
| <unistd.h> | 多种必要的POSIX函数与常量 | Issue 1 |
| <utime.h> | inode访问与修改时间 | Issue 3 |
| <utmpx.h> | 用户账号数据库函数 | Issue 4 |
| <wordexp.h> | 子扩展,类似于shell被执行 | Issue 4 |
3. 特定于Windows的函数库
| 头文件 | 描述 |
|---|
| windows.h | 包含Windows API中所有函数的声明,Windows程序员使用的所有常用宏,以及各种函数使用的所有数据类型 |
3.1 子头文件
windows.h中自动包含许多子头文件。由于依赖性,许多这些文件本身不能简单地包含在内(它们不是自包含的)。
windows.h可能包含以下任何头文件:
| 头文件 | 说明 |
|---|
| excpt.h | 异常处理 |
| stdarg.h | 变量参数函数(标准C头) |
| windef.h | 各种宏和类型 |
| winnt.h | 各种宏和类型(适用于Windows NT) |
| basetsd.h | 各种类型 |
| guiddef.h | GUID类型 |
| ctype.h | 字符分类(标准C头) |
| string.h | 字符串和缓冲区(标准C头) |
| winbase.h | kernel32.dll:内核服务; advapi32.dll:内核服务(例如CreateProcessAsUser函数),访问控制(例如AdjustTokenGroups函数)。 |
| winerror.h | Windows错误代码 |
| wingdi.h | GDI(图形设备接口) |
| winuser.h | user32.dll:用户服务 |
| winnls.h | NLS(母语支持) |
| wincon.h | 控制台服务 |
| winver.h | 版本信息 |
| winreg.h | Windows注册表 |
| winnetwk.h | WNet(Windows网络) |
| winsvc.h | Windows服务和SCM(服务控制管理器) |
| imm.h | IME(输入法编辑器) |
| 额外包括 | |
| cderr.h | CommDlgExtendedError函数错误代码 |
| commdlg.h | 通用对话框 |
| dde.h | DDE(动态数据交换) |
| ddeml.h | DDE管理库 |
| dlgs.h | 常用对话框的各种常量 |
| lzexpand.h | LZ(Lempel |
| mmsystem.h | Windows多媒体 |
| nb30.h | NetBIOS |
| rpc.h | RPC(远程过程调用) |
| shellapi.h | Windows Shell API |
| wincrypt.h | 加密API |
| winperf.h | 性能监控 |
| winresrc.h | 用于资源 |
| winsock.h | Winsock(Windows套接字),版本1.1 |
| winspool.h | 打印后台处理程序 |
| winbgim.h | 标准图形库 |
| OLE和COM | |
| ole2.h | OLE(对象链接和嵌入) |
| objbase.h | COM(组件对象模型) |
| oleauto.h | OLE自动化 |
| olectlid.h | 各种GUID定义 |
3.2 宏
几个宏会影响windows.h的行为。
| 宏 | 说明 |
|---|
| UNICODE | 定义时,这会导致TCHAR成为WCHAR而不是CHAR的同义词,并且所有类型通用API函数和使用文本的消息都将定义为-W版本而不是-A版本。(它类似于Windows C运行时的_UNICODE宏。) |
| RC_INVOKED | 在使用资源编译器(RC.EXE)而不是C编译器时定义。 |
| WINVER | 用于启用仅在较新的操作系统中可用的功能。它定义到0x0501为Windows XP中,并为0x0600为Windows Vista中。 |
| WIN32_LEAN_AND_MEAN | 用于减小头文件的大小并加快编译速度。不包括加密,DDE,RPC,Windows Shell和Winsock等内容。 |
参考: