|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
! G6 h7 t# w9 S/ N
, d1 T0 v- f1 |) p$ b. k( \<assert.h>:ANSI C。提供断言,assert(表达式)" K# t# A- n& B! f# |* s% w
<glib.h>:GCC。GTK,GNOME的基础库,提供很多有用的函数,如有数据结构操作函数。使用glib只需要包含<glib.h>
$ a5 s2 m2 e* e# l2 S1 b<dirent.h>:GCC。文件夹操作函数。struct dirent,struct DIR,opendir(),closedir(),readdir(),readdir64()等( N$ c1 t; [( c, d- Y9 K9 Z6 b
<ctype.h>:ANSI C。字符测试函数。isdigit(),islower()等) G0 K! b% ?5 {; y
<errno.h>:ANSI C。查看错误代码errno是调试程序的一个重要方法。当linuc C api函数发生异常时,一般会将errno变量(需include errno.h)赋一个整数值,不同的值表示不同的含义,可以通过查看该值推测出错的原因。在实际编程中用这一招解决了不少原本看来莫名其妙的问题。比较 麻烦的是每次都要去linux源代码里面查找错误代码的含义,现在把它贴出来,以后需要查时就来这里看了。来自linux 2.4.20-18的内核代码中的/usr/include/asm/errno.h1 ^8 ^2 w4 R8 {& S
<getopt.h>:处理命令行参数。getopt()4 o: F6 |" ]$ Q0 ]- O
& r4 ]& E4 L) n, j
-------------------------( r( ^4 x4 }& M7 {& z& O% b" o
/ N; n6 w# n X; x9 n+ f, S% c! a/ w1 U8 ]
linux常用头文件如下:) `1 O0 C. k6 P8 t
3 K4 B4 ~$ [" B4 f
0 \# }# y' a8 t T- a6 CPOSIX标准定义的头文件- f! x9 ]4 d, g8 J5 U+ y" ^
( x ?& U$ Y9 G1 l3 k
$ Q7 v/ t( _" l9 A, V" L1 i6 x' `<dirent.h> 目录项0 k: i( ^. K1 X2 f; q" I. m; t* _
<fcntl.h> 文件控制
3 u5 C0 }: Y D( J& y" v<fnmatch.h> 文件名匹配类型) U# p3 v% w. g" z
<glob.h> 路径名模式匹配类型
: C0 m% p& _4 ~) R/ L5 n. x<grp.h> 组文件! R' a3 N7 P. {; h+ v
<netdb.h> 网络数据库操作
# I& X2 c6 k" v1 h<pwd.h> 口令文件
2 H" h- [4 f) t) y/ u/ L<regex.h> 正则表达式: c. I- h! g/ i
<tar.h> TAR归档值
. A) f- I4 M# A<termios.h> 终端I/O( ^. |* _$ p" _7 }3 x! k# r. L4 e
<unistd.h> 符号常量
) s4 k" F) o E+ O+ M6 E<utime.h> 文件时间
( Y3 X( D/ O6 r1 _0 I/ i1 e1 u<wordexp.h> 字符扩展类型7 m9 S- U9 |* ~9 T* N4 v
; l8 f; B+ Y" E3 {
! B3 [9 |- s& s' |! m5 Q0 H# q3 W-------------------------
D# f, y: a7 |0 ^3 n; b8 R2 r, Q b1 h- _3 B! y, r! Q# [
3 s0 a* x4 m) v% o
<arpa/inet.h> INTERNET定义" A* b7 _ S; \
<net/if.h> 套接字本地接口
$ h4 T( t4 @9 i& O! ~<netinet/in.h> INTERNET地址族+ `1 n. c5 l' E L" [
<netinet/tcp.h> 传输控制协议定义
0 F5 |5 w: _' R; i" m: `
I7 ]! N* K* ~# B& i, @; R& k- |
/ {- S6 r4 N. W9 }------------------------- 1 n# f0 w$ ?7 }$ t0 E. y
6 q: Q4 u7 X; N
; L- S8 L( O2 t! D$ E5 m<sys/mman.h> 内存管理声明$ I; `8 f6 q* U& _' Q0 _! s
<sys/select.h> Select函数8 f* o/ k, T. R8 E9 M# N, ~
<sys/socket.h> 套接字借口
) F$ x9 M2 K# j<sys/stat.h> 文件状态
% s1 d; i) _! i: |% G( d8 N. T<sys/times.h> 进程时间
- {& s, N6 \& K+ L/ g0 \& F( T4 T+ q<sys/types.h> 基本系统数据类型
% S! g( r) R- h/ W4 X3 X<sys/un.h> UNIX域套接字定义
8 q& ~# s$ N- @: v# ?( q! [! A<sys/utsname.h> 系统名
. K; p( N' a/ Z1 n<sys/wait.h> 进程控制/ Q1 u, b4 H, _) A |
* U$ G! b5 K$ _ K2 E0 Z; k+ b
9 f7 d9 C4 Z' X. c------------------------------- m) t' j; f6 q: s7 Q" f
7 W* ~8 {. P* a f
) P. |5 _+ f A2 `9 V! O
POSIX定义的XSI扩展头文件6 b& i9 V* p+ L5 ^/ _
4 U# j8 F- w1 s7 [
6 c" J/ `0 E0 \8 \: h- ?+ h<cpio.h> cpio归档值
5 N8 z. u3 @6 h! p9 c. k<dlfcn.h> 动态链接# a) H( Y$ H7 L( d [/ M! W" @
<fmtmsg.h> 消息显示结构' d0 a. t, l& N# E0 T2 j$ l
<ftw.h> 文件树漫游) k4 F' ~4 P- p9 }
<iconv.h> 代码集转换使用程序5 @0 D7 x, _# W- W: ?. R5 d \
<langinfo.h> 语言信息常量, i: q) e2 |4 s% |8 \: F) _
<libgen.h> 模式匹配函数定义! i" F9 Q- h& u) K. H D
<monetary.h> 货币类型4 ~2 P& ]- k% D& [$ k) j2 E
<ndbm.h> 数据库操作
/ x0 W1 B8 f$ w" \* O: G# m<nl_types.h> 消息类别
, B: |' C$ ?$ b O; ]6 K O# s<poll.h> 轮询函数( i2 i8 T4 H) `( x4 S
<search.h> 搜索表
8 r& q# w; m H' j& K. v<strings.h> 字符串操作
+ ]4 t) W, T1 _' Q1 w2 q7 r<syslog.h> 系统出错日志记录% s1 E9 [9 i- ^1 S) z- ^5 F+ X
<ucontext.h> 用户上下文
/ I6 ?6 z E1 \7 `! }<ulimit.h> 用户限制" a- ~6 n7 p1 c( |
<utmpx.h> 用户帐户数据库 : Y p( G) A* x: s6 Q2 l: r! M7 S
( t: Y% M! j; \0 S
I) l$ ~3 m/ V( Q: n# {' y-----------------------------, n9 d. L0 t0 z5 O9 ?/ n# G
0 y, q; E7 s( y7 `4 Z9 j" o* _' I
<sys/ipc.h> IPC(命名管道)1 f( b5 D- g% q0 N$ S' j) C
<sys/msg.h> 消息队列0 c, w! {) H' U1 ?$ C7 J
<sys/resource.h>资源操作' o- m* Z* \9 ]+ b3 A& B2 w- y+ n6 ]
<sys/sem.h> 信号量4 {* C1 s5 c/ D+ ]+ b9 t; f
<sys/shm.h> 共享存储- ?0 A$ k# b, n. o; @$ L* }# r
<sys/statvfs.h> 文件系统信息' h$ M: Y* w& Y
<sys/time.h> 时间类型. A' A4 W; q6 H' S! {, p
<sys/timeb.h> 附加的日期和时间定义
- |6 E) F+ {* P9 L6 b<sys/uio.h> 矢量I/O操作
`% g, E$ ]6 {5 Y
9 [/ S& e! `9 ~' M! Y# u& H6 z. Q9 i6 s& U( ^- N. ^/ \- L) z
------------------------------$ V# U9 q/ ?5 O {: `3 v$ `
2 j1 v6 B* T, `. m& }3 d
: V4 }$ D3 |3 f4 q4 I3 \POSIX定义的可选头文件
+ m9 J8 w. r) G2 G C n. D% f& v6 j' a; ?5 R
: y) O* U( j+ \% ^
<aio.h> 异步I/O
8 J& b* w* n: U$ I<mqueue.h> 消息队列+ P9 a" S6 O8 ~7 P5 \+ R8 V0 s
<pthread.h> 线程: P, X( _8 k2 u
<sched.h> 执行调度
: A o4 q$ e% r<semaphore.h> 信号量' O$ m: ~6 E. ]4 ?
<spawn.h> 实时spawn接口7 M9 t% o- [* \" `& ]7 |8 b: m# G
<stropts.h> XSI STREAMS接口
% R5 {# S8 Y9 C0 W( E3 k: o4 E<trace.h> 事件跟踪$ W2 x2 G5 `3 r1 [" }
% j4 j% m6 o" E P' h C' ?# a
% ^" p3 T( X. O F+ t) s
3、 C/C++头文件一览
7 @% [6 X+ U) E* ?$ C
4 X, F4 a" ~2 w' c6 K$ _) e$ ^1 n, T
9 @ A1 H, c8 Z' x4 c" c/ z# JC
: [. K8 d6 E2 |6 S/ Q6 L. ?5 O1 R( i0 y4 ?* F' E+ |& c
" Q- J2 _% Q3 ~& J$ l5 u5 K3 W#include <assert.h> //设定插入点
2 x, F" U5 L- [#include <ctype.h> //字符处理
* j" s, R5 S$ s+ m* v#include <errno.h> //定义错误码
/ M# e1 X) z$ [1 D( K#include <float.h> //浮点数处理3 | j) d7 x7 c9 h, E4 f6 W ]; F
#include <iso646.h> //对应各种运算符的宏7 _( i' m$ r' c9 Z! A
#include <limits.h> //定义各种数据类型最值的常量
7 W7 a* a( ?$ ]# y6 o& \2 @7 g, y) y#include <locale.h> //定义本地化C函数
; n' L8 j5 ^$ z; C7 g: d4 a* \#include <math.h> //定义数学函数
& d$ o, C4 j, y; J) T" P#include <setjmp.h> //异常处理支持4 y1 q9 g7 |+ I. _
#include <signal.h> //信号机制支持
) h% V' t! E) v" n: q1 [#include <stdarg.h> //不定参数列表支持
: Q) c( s" U% k5 n5 U3 i#include <stddef.h> //常用常量5 ]8 ~& L. a/ c% M- x. F# U) m( B
#include <stdio.h> //定义输入/输出函数. W* Z8 ~( o- R, p7 {% J
#include <stdlib.h> //定义杂项函数及内存分配函数
9 v5 _1 \/ b+ a! U F#include <string.h> //字符串处理
& K! E. s+ M" V/ r9 g#include <time.h> //定义关于时间的函数
7 h4 W4 d; v1 l% t#include <wchar.h> //宽字符处理及输入/输出
3 }7 W. d7 y( G/ H3 f. |#include <wctype.h> //宽字符分类2 c$ C; x0 [) z
7 x9 d5 O8 k0 {. s& ~
/ G) \" ?1 I- f+ k
传统C++' L( r9 j" P) [1 @6 f
# i6 H3 ]* k/ P) g
' U8 u* z- `; v#include <fstream.h> //改用<fstream>
1 v/ F# w1 i- @' }9 d- z$ B#include <iomanip.h> //改用<iomainip>
. f. l a! U8 E9 `5 r#include <iostream.h> //改用<iostream>
8 M& \9 @3 K; C3 q. ~#include <strstrea.h> //该类不再支持,改用<sstream>中的stringstream+ D0 p3 I) c0 K- ^$ b
2 X' e! z% \- a- J
/ o( k* p; @8 f9 `4 k/ W$ `+ h6 c
————————————————————————————————
$ l1 ?3 [1 ~6 ^! S1 }/ ?5 Q% t3 u' b5 P0 w
3 {! y9 u* u; ]* ]8 y
标准C++
! O9 ]. p8 F0 s& h3 m- r+ J# c4 c+ ?3 Q/ v5 }. \
$ i+ |2 s/ o* z: h3 C& H8 Y* F
#include <algorithm> //STL 通用算法" }' H9 `+ t# q0 G- d, X6 c/ w
#include <bitset> //STL 位集容器) y1 V) ~8 P( X- }" e. q$ {
#include <cctype> //字符处理
; C e! Z( i0 X* A: g#include <cerrno> //定义错误码0 J* g0 q. [; i1 ^9 F! d% x: W0 f
#include <cfloat> //浮点数处理
7 s7 d: E% {( W1 q% V, p% L#include <ciso646> //对应各种运算符的宏
( M8 C* o- v( W+ A#include <climits> //定义各种数据类型最值的常量
; [2 R6 y2 B; D- K$ A8 V7 `#include <clocale> //定义本地化函数! a. t; S& x# E! H. D! L
#include <cmath> //定义数学函数4 w6 j. p% J4 ?, p6 W8 k2 G; E/ ?- a
#include <complex> //复数类
! j" a7 W+ u7 Q* f; n# w, i$ a#include <csignal> //信号机制支持
* c2 H. ?" [+ o' o9 \#include <csetjmp> //异常处理支持: E) ]: w6 t1 j& U$ M4 w
#include <cstdarg> //不定参数列表支持
3 |1 v9 G$ e; r- g#include <cstddef> //常用常量
' C$ k( d$ W, y9 x% e* P, N2 y#include <cstdio> //定义输入/输出函数
5 D0 D# |+ C# T#include <cstdlib> //定义杂项函数及内存分配函数) T, ] w' o0 T& C& R
#include <cstring> //字符串处理
" [+ ]1 j# b2 y#include <ctime> //定义关于时间的函数
* h( p! {0 n: S0 C6 n- \5 Z1 Z' U1 i#include <cwchar> //宽字符处理及输入/输出; _6 e. p3 _! S, @1 o
#include <cwctype> //宽字符分类5 T, Y4 Z1 n1 G$ f+ r6 {' k
#include <deque> //STL 双端队列容器
0 V; k5 r6 D8 K2 b8 `#include <exception> //异常处理类
5 `$ @' C! V! V* \* L#include <fstream> //文件输入/输出7 _; }" h/ @- P
#include <functional> //STL 定义运算函数(代替运算符)+ a* r" q- I0 z. m
#include <limits> //定义各种数据类型最值常量% ]8 |* Z3 r& N& C
#include <list> //STL 线性列表容器
' @2 P' W$ W- I#include <locale> //本地化特定信息
7 A6 P) O a7 h, D" ]#include <map> //STL 映射容器2 N3 n- Q K& P% c8 ] Z
#include <memory> //STL通过分配器进行的内存分配
& d8 i* _4 ]7 n$ J2 f, F7 Y#include <new> //动态内存分配4 O" e* J0 ^1 g9 O9 y
#include <numeric> //STL常用的数字操作
/ c/ L% F1 z& i* b/ \#include <iomanip> //参数化输入/输出
0 ?8 v9 s, O4 O# ?6 Y! h#include <ios> //基本输入/输出支持" k E, C' ]0 H+ l
#include <iosfwd> //输入/输出系统使用的前置声明
9 h3 `2 |& m' ~) h#include <iostream> //数据流输入/输出. w$ X+ x+ N9 @+ I
#include <istream> //基本输入流( E" o# k! T! H0 v
#include <iterator> //STL迭代器" q/ M% U8 f8 s7 R2 k
#include <ostream> //基本输出流* p/ i0 M8 Y, ` x3 q
#include <queue> //STL 队列容器1 R) N0 j) {. p1 l8 l+ w
#include <set> //STL 集合容器
& w) X$ v7 `2 V4 A4 Q#include <sstream> //基于字符串的流
6 K5 I" m7 D4 g3 p D, L8 m4 P3 J9 i#include <stack> //STL 堆栈容器
! Z0 O; S* l+ _1 o' s a#include <stdexcept> //标准异常类. Q* Y! ]( e) A8 A( D! o* `/ }4 P
#include <streambuf> //底层输入/输出支持
4 i! x5 N9 M) H+ B! B) f( ] m#include <string> //字符串类
7 T' v% r# a( u0 v, [: C#include <typeinfo> //运行期间类型信息6 H# b3 K# P, Y6 a$ \
#include <utility> //STL 通用模板类% T6 X7 I+ l$ L9 D( [/ Q
#include <valarray> //对包含值的数组的操作
5 @9 F5 w7 V5 P$ n0 ~6 O#include <vector> //STL 动态数组容器9 `2 Z5 w" _$ }: a
; V# V, A( U$ b9 r7 A6 B
; }$ W: [1 o0 e7 V: N! ~3 T) n6 F
2 C- R2 F6 l& ~8 f! K5 Y: {+ K1 X9 i7 l
) t; b, U( [+ G. z. n% b' q
( O, E: f+ w: l7 B8 B% H0 l
$ }9 P. a% {3 p8 H- F% T& Y* ^0 j) J) V0 [
% l! m. |. K: {, Y
|
|