1、 Linux中一些头文件的作用:
<assert.h>:ANSI C。提供断言,assert(表达式)
<glib.h>:GCC。GTK,GNOME的基础库,提供很多有用的函数,如有数据结构操作函数。使用glib只需要包含<glib.h>
<dirent.h>:GCC。文件夹操作函数。struct dirent,struct DIR,opendir(),closedir(),readdir(),readdir64()等
<ctype.h>:ANSI C。字符测试函数。isdigit(),islower()等
<errno.h>:ANSI C。查看错误代码errno是调试程序的一个重要方法。当linuc C api函数发生异常时,一般会将errno变量(需include errno.h)赋一个整数值,不同的值表示不同的含义,可以通过查看该值推测出错的原因。在实际编程中用这一招解决了不少原本看来莫名其妙的问题。比较麻烦的是每次都要去linux源代码里面查找错误代码的含义,现在把它贴出来,以后需要查时就来这里看了。来自linux 2.4.20-18的内核代码中的/usr/include/asm/errno.h
<getopt.h>:处理命令行参数。getopt()
2、
-------------------------
linux常用头文件如下:
POSIX标准定义的头文件
<dirent.h> <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>目录项<br> <fcntl.h> <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>文件控制<br> <fnmatch.h> <wbr><wbr><wbr><wbr><wbr><wbr>文件名匹配类型<br> <glob.h> <wbr><wbr><wbr><wbr><wbr><wbr>路径名模式匹配类型<br> <grp.h> <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>组文件<br> <netdb.h> <wbr><wbr><wbr><wbr><wbr><wbr>网络数据库操作<br> <pwd.h> <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>口令文件<br> <regex.h> <wbr><wbr><wbr><wbr><wbr><wbr>正则表达式<br> <tar.h> <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>TAR归档值<br> <termios.h> <wbr><wbr><wbr><wbr><wbr><wbr>终端I/O<br> <unistd.h> <wbr><wbr><wbr><wbr><wbr><wbr>符号常量<br> <utime.h> <wbr><wbr><wbr><wbr><wbr><wbr>文件时间<br> <wordexp.h> <wbr><wbr><wbr><wbr><wbr><wbr>字符扩展类型<br> -------------------------<br> <arpa/inet.h> <wbr><wbr><wbr><wbr><wbr><wbr>INTERNET定义<br> <net/if.h> <wbr><wbr><wbr><wbr><wbr><wbr>套接字本地接口<br> <netinet/in.h> <wbr><wbr><wbr><wbr><wbr><wbr>INTERNET地址族<br> <netinet/tcp.h> <wbr><wbr><wbr><wbr><wbr><wbr>传输控制协议定义<br> -------------------------<br> <sys/mman.h> <wbr><wbr><wbr><wbr><wbr><wbr>内存管理声明<br> <sys/select.h> <wbr><wbr><wbr><wbr><wbr><wbr>Select函数<br> <sys/socket.h> <wbr><wbr><wbr><wbr><wbr><wbr>套接字借口<br> <sys/stat.h> <wbr><wbr><wbr><wbr><wbr><wbr>文件状态<br> <sys/times.h> <wbr><wbr><wbr><wbr><wbr><wbr>进程时间<br> <sys/types.h> <wbr><wbr><wbr><wbr><wbr><wbr>基本系统数据类型<br> <sys/un.h> <wbr><wbr><wbr><wbr><wbr><wbr>UNIX域套接字定义<br> <sys/utsname.h> <wbr><wbr><wbr><wbr><wbr><wbr>系统名<br> <sys/wait.h> <wbr><wbr><wbr><wbr><wbr><wbr>进程控制<br> ------------------------------<br> POSIX定义的XSI扩展头文件<br> <cpio.h> <wbr><wbr><wbr><wbr><wbr><wbr>cpio归档值<br> <dlfcn.h> <wbr><wbr><wbr><wbr><wbr><wbr>动态链接<br> <fmtmsg.h> <wbr><wbr><wbr><wbr><wbr><wbr>消息显示结构<br> <ftw.h> <wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>文件树漫游<br> <iconv.h> <wbr><wbr><wbr><wbr><wbr><wbr>代码集转换使用程序<br> <langinfo.h> <wbr><wbr><wbr><wbr><wbr><wbr>语言信息常量<br> <libgen.h> <wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>