Linux中常用C/C++一些头文件的作用

  1. <assert.h>:ANSI C。提供断言,assert(表达式)  
  2. <glib.h>:GCC。GTK,GNOME的基础库,提供很多有用的函数,如有数据结构操作函数。使用glib只需要包含<glib.h>  
  3. <dirent.h>:GCC。文件夹操作函数。struct dirent,struct DIR,opendir(),closedir(),readdir(),readdir64()等  
  4. <ctype.h>:ANSI C。字符测试函数。isdigit(),islower()等  
  5. <errno.h>:ANSI C。查看错误代码errno是调试程序的一个重要方法。当linuc C api函数发生异常时,一般会将errno变量(需include errno.h)赋一个整数值,不同的值表示不同的含义,可以通过查看该值推测出错的原因。在实际编程中用这一招解决了不少原本看来莫名其妙的问题。比较 麻烦的是每次都要去linux源代码里面查找错误代码的含义,现在把它贴出来,以后需要查时就来这里看了。来自linux 2.4.20-18的内核代码中的/usr/include/asm/errno.h  
  6. <getopt.h>:处理命令行参数。getopt()  
  7.   
  8. -------------------------  
  9. linux常用头文件如下:  
  10. POSIX标准定义的头文件  
  11. <dirent.h>        目录项  
  12. <fcntl.h>         文件控制  
  13. <fnmatch.h>    文件名匹配类型  
  14. <glob.h>    路径名模式匹配类型  
  15. <grp.h>        组文件  
  16. <netdb.h>    网络数据库操作  
  17. <pwd.h>        口令文件  
  18. <regex.h>    正则表达式  
  19. <tar.h>        TAR归档值  
  20. <termios.h>    终端I/O  
  21. <unistd.h>    符号常量  
  22. <utime.h>    文件时间  
  23. <wordexp.h>    字符扩展类型  
  24. -------------------------  
  25. <arpa/inet.h>    INTERNET定义  
  26. <net/if.h>    套接字本地接口  
  27. <netinet/in.h>    INTERNET地址族  
  28. <netinet/tcp.h>    传输控制协议定义  
  29. -------------------------   
  30. <sys/mman.h>    内存管理声明  
  31. <sys/select.h>    Select函数  
  32. <sys/socket.h>    套接字借口  
  33. <sys/stat.h>    文件状态  
  34. <sys/times.h>    进程时间  
  35. <sys/types.h>    基本系统数据类型  
  36. <sys/un.h>    UNIX域套接字定义  
  37. <sys/utsname.h>    系统名  
  38. <sys/wait.h>    进程控制  
  39. ------------------------------  
  40. POSIX定义的XSI扩展头文件  
  41. <cpio.h>    cpio归档值   
  42. <dlfcn.h>    动态链接  
  43. <fmtmsg.h>    消息显示结构  
  44. <ftw.h>        文件树漫游  
  45. <iconv.h>    代码集转换使用程序  
  46. <langinfo.h>    语言信息常量  
  47. <libgen.h>    模式匹配函数定义  
  48. <monetary.h>    货币类型  
  49. <ndbm.h>    数据库操作  
  50. <nl_types.h>    消息类别  
  51. <poll.h>    轮询函数  
  52. <search.h>    搜索表  
  53. <strings.h>    字符串操作  
  54. <syslog.h>    系统出错日志记录  
  55. <ucontext.h>    用户上下文  
  56. <ulimit.h>    用户限制  
  57. <utmpx.h>    用户帐户数据库   
  58. -----------------------------  
  59. <sys/ipc.h>    IPC(命名管道)  
  60. <sys/msg.h>    消息队列  
  61. <sys/resource.h>资源操作  
  62. <sys/sem.h>    信号量  
  63. <sys/shm.h>    共享存储  
  64. <sys/statvfs.h>    文件系统信息  
  65. <sys/time.h>    时间类型  
  66. <sys/timeb.h>    附加的日期和时间定义  
  67. <sys/uio.h>    矢量I/O操作  
  68. ------------------------------  
  69. POSIX定义的可选头文件  
  70. <aio.h>        异步I/O  
  71. <mqueue.h>    消息队列  
  72. <pthread.h>    线程  
  73. <sched.h>    执行调度  
  74. <semaphore.h>    信号量  
  75. <spawn.h>     实时spawn接口  
  76. <stropts.h>    XSI STREAMS接口  
  77. <trace.h>     事件跟踪  
  78. 3、 C/C++头文件一览  
  79. C  
  80. #include <assert.h>    //设定插入点  
  81. #include <ctype.h>     //字符处理  
  82. #include <errno.h>     //定义错误码  
  83. #include <float.h>     //浮点数处理  
  84. #include <iso646.h>        //对应各种运算符的宏  
  85. #include <limits.h>    //定义各种数据类型最值的常量  
  86. #include <locale.h>    //定义本地化C函数  
  87. #include <math.h>     //定义数学函数  
  88. #include <setjmp.h>        //异常处理支持  
  89. #include <signal.h>        //信号机制支持  
  90. #include <stdarg.h>        //不定参数列表支持  
  91. #include <stddef.h>        //常用常量  
  92. #include <stdio.h>     //定义输入/输出函数  
  93. #include <stdlib.h>    //定义杂项函数及内存分配函数  
  94. #include <string.h>    //字符串处理  
  95. #include <time.h>     //定义关于时间的函数  
  96. #include <wchar.h>     //宽字符处理及输入/输出  
  97. #include <wctype.h>    //宽字符分类  
  98. 传统C++  
  99. #include <fstream.h>    //改用<fstream>  
  100. #include <iomanip.h>    //改用<iomainip>  
  101. #include <iostream.h>   //改用<iostream>  
  102. #include <strstrea.h>   //该类不再支持,改用<sstream>中的stringstream  
  103. ————————————————————————————————  
  104. 标准C++   
  105. #include <algorithm>    //STL 通用算法  
  106. #include <bitset>     //STL 位集容器  
  107. #include <cctype>          //字符处理  
  108. #include <cerrno>      //定义错误码  
  109. #include <cfloat>     //浮点数处理  
  110. #include <ciso646>         //对应各种运算符的宏  
  111. #include <climits>     //定义各种数据类型最值的常量  
  112. #include <clocale>     //定义本地化函数  
  113. #include <cmath>      //定义数学函数  
  114. #include <complex>     //复数类  
  115. #include <csignal>         //信号机制支持  
  116. #include <csetjmp>         //异常处理支持  
  117. #include <cstdarg>         //不定参数列表支持  
  118. #include <cstddef>         //常用常量  
  119. #include <cstdio>      //定义输入/输出函数  
  120. #include <cstdlib>     //定义杂项函数及内存分配函数  
  121. #include <cstring>     //字符串处理  
  122. #include <ctime>      //定义关于时间的函数  
  123. #include <cwchar>      //宽字符处理及输入/输出  
  124. #include <cwctype>     //宽字符分类  
  125. #include <deque>      //STL 双端队列容器  
  126. #include <exception>    //异常处理类  
  127. #include <fstream>     //文件输入/输出  
  128. #include <functional>   //STL 定义运算函数(代替运算符)  
  129. #include <limits>      //定义各种数据类型最值常量  
  130. #include <list>      //STL 线性列表容器  
  131. #include <locale>          //本地化特定信息  
  132. #include <map>       //STL 映射容器  
  133. #include <memory>          //STL通过分配器进行的内存分配  
  134. #include <new>             //动态内存分配  
  135. #include <numeric>         //STL常用的数字操作  
  136. #include <iomanip>     //参数化输入/输出  
  137. #include <ios>       //基本输入/输出支持  
  138. #include <iosfwd>     //输入/输出系统使用的前置声明  
  139. #include <iostream>     //数据流输入/输出  
  140. #include <istream>     //基本输入流  
  141. #include <iterator>        //STL迭代器  
  142. #include <ostream>     //基本输出流  
  143. #include <queue>      //STL 队列容器  
  144. #include <set>       //STL 集合容器  
  145. #include <sstream>     //基于字符串的流  
  146. #include <stack>      //STL 堆栈容器  
  147. #include <stdexcept>    //标准异常类  
  148. #include <streambuf>    //底层输入/输出支持  
  149. #include <string>     //字符串类  
  150. #include <typeinfo>        //运行期间类型信息  
  151. #include <utility>     //STL 通用模板类  
  152. #include <valarray>        //对包含值的数组的操作  
  153. #include <vector>     //STL 动态数组容器  

原文:https://blog.csdn.net/wqx521/article/details/52650559

猜你喜欢

转载自blog.csdn.net/httpdrestart/article/details/80685370
今日推荐