C标准库学习之其他
2007-05-26 17:20
134 查看
C Standard Library
[Last modified : 2006-11-30]
Contents
* <assert.h> : 诊断
* <ctype.h> : 字符类测试
* <errno.h> : 其他库函数的错误代码报告
* <float.h> : Implementation-defined Floating-Point Limits
* <limits.h> : Implementation-defined Limits
* <locale.h> : Locale-specific Information
* <math.h> : 数学函数
* <setjmp.h> : Non-local Jumps
* <signal.h> : Signals
* <stdarg.h> : Variable Argument Lists
* <stddef.h> : 一般用途的定义
* <stdio.h> : I/O库
* <stdlib.h> :标准库
* <string.h> : 字符串函数
* <time.h> : 时间日期函数
<assert.h>
void assert(int expression);
Macro used for internal error detection. (Ignored if NDEBUG is defined where <assert.h> is included.) If expression
equals zero, message printed on stderr and abort called to terminate execution. Source filename and line number in message
are from preprocessor macros __FILE__ and __LINE__.
一个用于内部错误诊断的宏。
<ctype.h>
int isalnum(int c);
isalpha(c) or isdigit(c)
int isalpha(int c);
isupper(c) or islower(c)
int iscntrl(int c);
is control character. In ASCII, control characters are 0x00 (NUL) to 0x1F (US), and 0x7F (DEL)
int isdigit(int c);
is decimal digit
int isgraph(int c);
is printing character other than space
int islower(int c);
is lower-case letter
int isprint(int c);
is printing character (including space). In ASCII, printing characters are 0x20 (' ') to 0x7E ('~')
int ispunct(int c);
is printing character other than space, letter, digit
int isspace(int c);
is space, formfeed, newline, carriage return, tab, vertical tab
int isupper(int c);
is upper-case letter
int isxdigit(int c);
is hexadecimal digit
int tolower(int c);
return lower-case equivalent
int toupper(int c);
return upper-case equivalent
<errno.h>
errno
object to which certain library functions assign specific positive values on error
EDOM
code used for domain errors
ERANGE
code used for range errors
Notes:
* other implementation-defined error values are permitted
* to determine the value (if any) assigned to errno by a library function, a program should assign zero to errno
immediately prior to the function call
<float.h>
FLT_RADIX
radix of floating-point representations
FLT_ROUNDS
floating-point rounding mode
Where the prefix "FLT" pertains to type float, "DBL" to type double, and "LDBL" to type long double:
FLT_DIG
DBL_DIG
LDBL_DIG
precision (in decimal digits)
FLT_EPSILON
DBL_EPSILON
LDBL_EPSILON
smallest number x such that 1.0 + x != 1.0
FLT_MANT_DIG
DBL_MANT_DIG
LDBL_MANT_DIG
number of digits, base FLT_RADIX, in mantissa
FLT_MAX
DBL_MAX
LDBL_MAX
maximum number
FLT_MAX_EXP
DBL_MAX_EXP
LDBL_MAX_EXP
largest positive integer exponent to which FLT_RADIX can be raised and remain representable
FLT_MIN
DBL_MIN
LDBL_MIN
minimum normalised number
FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
smallest negative integer exponent to which FLT_RADIX can be raised and remain representable
<limits.h>
CHAR_BIT
number of bits in a char
CHAR_MAX
maximum value of type char
CHAR_MIN
minimum value of type char
SCHAR_MAX
maximum value of type signed char
SCHAR_MIN
minimum value of type signed char
UCHAR_MAX
maximum value of type unsigned char
SHRT_MAX
maximum value of type short
SHRT_MIN
minimum value of type short
USHRT_MAX
maximum value of type unsigned short
INT_MAX
maximum value of type int
INT_MIN
minimum value of type int
UINT_MAX
maximum value of type unsigned int
LONG_MAX
maximum value of type long
LONG_MIN
minimum value of type long
ULONG_MAX
maximum value of type unsigned long
<locale.h>
struct lconv
Describes formatting of monetary and other numeric values:
char* decimal_point;
decimal point for non-monetary values
char* grouping;
sizes of digit groups for non-monetary values
char* thousands_sep;
separator for digit groups for non-monetary values (left of "decimal point")
char* currency_symbol;
currency symbol
char* int_curr_symbol;
international currency symbol
char* mon_decimal_point;
decimal point for monetary values
char* mon_grouping;
sizes of digit groups for monetary values
char* mon_thousands_sep;
separator for digit groups for monetary values (left of "decimal point")
char* negative_sign;
negative sign for monetary values
char* positive_sign;
positive sign for monetary values
char frac_digits;
number of digits to be displayed to right of "decimal point" for monetary values
char int_frac_digits;
number of digits to be displayed to right of "decimal point" for international monetary values
char n_cs_precedes;
whether currency symbol precedes (1) or follows (0) negative monetary values
char n_sep_by_space;
whether currency symbol is (1) or is not (0) separated by space from negative monetary values
char n_sign_posn;
format for negative monetary values:
0
parentheses surround quantity and currency symbol
1
sign precedes quantity and currency symbol
2
sign follows quantity and currency symbol
3
sign immediately precedes currency symbol
4
sign immediately follows currency symbol
char p_cs_precedes;
whether currency symbol precedes (1) or follows (0) positive monetary values
char p_sep_by_space;
whether currency symbol is (1) or is not (0) separated by space from non-negative monetary values
char p_sign_posn;
format for non-negative monetary values, with values as for n_sign_posn
Implementations may change field order and include additional fields. Standard C Library functions use only
decimal_point.
struct lconv* localeconv(void);
returns pointer to formatting information for current locale
char* setlocale(int category, const char* locale);
Sets components of locale according to specified category and locale. Returns string describing new locale or null on
error. (Implementations are permitted to define values of category additional to those describe here.)
LC_ALL
category argument for all categories
LC_NUMERIC
category for numeric formatting information
LC_MONETARY
category for monetary formatting information
LC_COLLATE
category for information affecting collating functions
LC_CTYPE
category for information affecting character class tests functions
LC_TIME
category for information affecting time conversions functions
NULL
null pointer constant
<math.h>
略
<setjmp.h>
jmp_buf
type of object holding context information
int setjmp(jmp_buf env);
Saves context information in env and returns zero. Subsequent call to longjmp with same env returns non-zero.
void longjmp(jmp_buf env, int val);
Restores context saved by most recent call to setjmp with specified env. Execution resumes as a second return from
setjmp, with returned value val if specified value non-zero, or 1 otherwise.
<signal.h>
SIGABRT
abnormal termination
SIGFPE
arithmetic error
SIGILL
invalid execution
SIGINT
(asynchronous) interactive attention
SIGSEGV
illegal storage access
SIGTERM
(asynchronous) termination request
SIG_DFL
specifies default signal handling
SIG_ERR
signal return value indicating error
SIG_IGN
specifies that signal should be ignored
void (*signal(int sig, void (*handler)(int)))(int);
Install handler for subsequent signal sig. If handler is SIG_DFL, implementation-defined default behaviour will be used;
if SIG_IGN, signal will be ignored; otherwise function pointed to by handler will be invoked with argument sig. In the last
case, handling is restored to default behaviour before handler is called. If handler returns, execution resumes where signal
occurred. signal returns the previous handler or SIG_ERR on error. Initial state is implementation-defined. Implementations
may may define signals additional to those listed here.
int raise(int sig);
Sends signal sig. Returns zero on success.
<stdarg.h>
va_list
type of object holding context information
void va_start(va_list ap, lastarg);
Initialisation macro which must be called once before any unnamed argument is accessed. Stores context information in ap.
lastarg is the last named parameter of the function.
type va_arg(va_list ap, type);
Yields value of the type (type) and value of the next unnamed argument.
void va_end(va_list ap);
Termination macro which must be called once after argument processing and before exit from function.
<stddef.h>
NULL
Null pointer constant.
offsetof(stype, m)
Offset (in bytes) of member m from start of structure type stype.
ptrdiff_t
Type for objects declared to store result of subtracting pointers.
size_t
Type for objects declared to store result of sizeof operator.
[Last modified : 2006-11-30]
Contents
* <assert.h> : 诊断
* <ctype.h> : 字符类测试
* <errno.h> : 其他库函数的错误代码报告
* <float.h> : Implementation-defined Floating-Point Limits
* <limits.h> : Implementation-defined Limits
* <locale.h> : Locale-specific Information
* <math.h> : 数学函数
* <setjmp.h> : Non-local Jumps
* <signal.h> : Signals
* <stdarg.h> : Variable Argument Lists
* <stddef.h> : 一般用途的定义
* <stdio.h> : I/O库
* <stdlib.h> :标准库
* <string.h> : 字符串函数
* <time.h> : 时间日期函数
<assert.h>
void assert(int expression);
Macro used for internal error detection. (Ignored if NDEBUG is defined where <assert.h> is included.) If expression
equals zero, message printed on stderr and abort called to terminate execution. Source filename and line number in message
are from preprocessor macros __FILE__ and __LINE__.
一个用于内部错误诊断的宏。
<ctype.h>
int isalnum(int c);
isalpha(c) or isdigit(c)
int isalpha(int c);
isupper(c) or islower(c)
int iscntrl(int c);
is control character. In ASCII, control characters are 0x00 (NUL) to 0x1F (US), and 0x7F (DEL)
int isdigit(int c);
is decimal digit
int isgraph(int c);
is printing character other than space
int islower(int c);
is lower-case letter
int isprint(int c);
is printing character (including space). In ASCII, printing characters are 0x20 (' ') to 0x7E ('~')
int ispunct(int c);
is printing character other than space, letter, digit
int isspace(int c);
is space, formfeed, newline, carriage return, tab, vertical tab
int isupper(int c);
is upper-case letter
int isxdigit(int c);
is hexadecimal digit
int tolower(int c);
return lower-case equivalent
int toupper(int c);
return upper-case equivalent
<errno.h>
errno
object to which certain library functions assign specific positive values on error
EDOM
code used for domain errors
ERANGE
code used for range errors
Notes:
* other implementation-defined error values are permitted
* to determine the value (if any) assigned to errno by a library function, a program should assign zero to errno
immediately prior to the function call
<float.h>
FLT_RADIX
radix of floating-point representations
FLT_ROUNDS
floating-point rounding mode
Where the prefix "FLT" pertains to type float, "DBL" to type double, and "LDBL" to type long double:
FLT_DIG
DBL_DIG
LDBL_DIG
precision (in decimal digits)
FLT_EPSILON
DBL_EPSILON
LDBL_EPSILON
smallest number x such that 1.0 + x != 1.0
FLT_MANT_DIG
DBL_MANT_DIG
LDBL_MANT_DIG
number of digits, base FLT_RADIX, in mantissa
FLT_MAX
DBL_MAX
LDBL_MAX
maximum number
FLT_MAX_EXP
DBL_MAX_EXP
LDBL_MAX_EXP
largest positive integer exponent to which FLT_RADIX can be raised and remain representable
FLT_MIN
DBL_MIN
LDBL_MIN
minimum normalised number
FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
smallest negative integer exponent to which FLT_RADIX can be raised and remain representable
<limits.h>
CHAR_BIT
number of bits in a char
CHAR_MAX
maximum value of type char
CHAR_MIN
minimum value of type char
SCHAR_MAX
maximum value of type signed char
SCHAR_MIN
minimum value of type signed char
UCHAR_MAX
maximum value of type unsigned char
SHRT_MAX
maximum value of type short
SHRT_MIN
minimum value of type short
USHRT_MAX
maximum value of type unsigned short
INT_MAX
maximum value of type int
INT_MIN
minimum value of type int
UINT_MAX
maximum value of type unsigned int
LONG_MAX
maximum value of type long
LONG_MIN
minimum value of type long
ULONG_MAX
maximum value of type unsigned long
<locale.h>
struct lconv
Describes formatting of monetary and other numeric values:
char* decimal_point;
decimal point for non-monetary values
char* grouping;
sizes of digit groups for non-monetary values
char* thousands_sep;
separator for digit groups for non-monetary values (left of "decimal point")
char* currency_symbol;
currency symbol
char* int_curr_symbol;
international currency symbol
char* mon_decimal_point;
decimal point for monetary values
char* mon_grouping;
sizes of digit groups for monetary values
char* mon_thousands_sep;
separator for digit groups for monetary values (left of "decimal point")
char* negative_sign;
negative sign for monetary values
char* positive_sign;
positive sign for monetary values
char frac_digits;
number of digits to be displayed to right of "decimal point" for monetary values
char int_frac_digits;
number of digits to be displayed to right of "decimal point" for international monetary values
char n_cs_precedes;
whether currency symbol precedes (1) or follows (0) negative monetary values
char n_sep_by_space;
whether currency symbol is (1) or is not (0) separated by space from negative monetary values
char n_sign_posn;
format for negative monetary values:
0
parentheses surround quantity and currency symbol
1
sign precedes quantity and currency symbol
2
sign follows quantity and currency symbol
3
sign immediately precedes currency symbol
4
sign immediately follows currency symbol
char p_cs_precedes;
whether currency symbol precedes (1) or follows (0) positive monetary values
char p_sep_by_space;
whether currency symbol is (1) or is not (0) separated by space from non-negative monetary values
char p_sign_posn;
format for non-negative monetary values, with values as for n_sign_posn
Implementations may change field order and include additional fields. Standard C Library functions use only
decimal_point.
struct lconv* localeconv(void);
returns pointer to formatting information for current locale
char* setlocale(int category, const char* locale);
Sets components of locale according to specified category and locale. Returns string describing new locale or null on
error. (Implementations are permitted to define values of category additional to those describe here.)
LC_ALL
category argument for all categories
LC_NUMERIC
category for numeric formatting information
LC_MONETARY
category for monetary formatting information
LC_COLLATE
category for information affecting collating functions
LC_CTYPE
category for information affecting character class tests functions
LC_TIME
category for information affecting time conversions functions
NULL
null pointer constant
<math.h>
略
<setjmp.h>
jmp_buf
type of object holding context information
int setjmp(jmp_buf env);
Saves context information in env and returns zero. Subsequent call to longjmp with same env returns non-zero.
void longjmp(jmp_buf env, int val);
Restores context saved by most recent call to setjmp with specified env. Execution resumes as a second return from
setjmp, with returned value val if specified value non-zero, or 1 otherwise.
<signal.h>
SIGABRT
abnormal termination
SIGFPE
arithmetic error
SIGILL
invalid execution
SIGINT
(asynchronous) interactive attention
SIGSEGV
illegal storage access
SIGTERM
(asynchronous) termination request
SIG_DFL
specifies default signal handling
SIG_ERR
signal return value indicating error
SIG_IGN
specifies that signal should be ignored
void (*signal(int sig, void (*handler)(int)))(int);
Install handler for subsequent signal sig. If handler is SIG_DFL, implementation-defined default behaviour will be used;
if SIG_IGN, signal will be ignored; otherwise function pointed to by handler will be invoked with argument sig. In the last
case, handling is restored to default behaviour before handler is called. If handler returns, execution resumes where signal
occurred. signal returns the previous handler or SIG_ERR on error. Initial state is implementation-defined. Implementations
may may define signals additional to those listed here.
int raise(int sig);
Sends signal sig. Returns zero on success.
<stdarg.h>
va_list
type of object holding context information
void va_start(va_list ap, lastarg);
Initialisation macro which must be called once before any unnamed argument is accessed. Stores context information in ap.
lastarg is the last named parameter of the function.
type va_arg(va_list ap, type);
Yields value of the type (type) and value of the next unnamed argument.
void va_end(va_list ap);
Termination macro which must be called once after argument processing and before exit from function.
<stddef.h>
NULL
Null pointer constant.
offsetof(stype, m)
Offset (in bytes) of member m from start of structure type stype.
ptrdiff_t
Type for objects declared to store result of subtracting pointers.
size_t
Type for objects declared to store result of sizeof operator.
相关文章推荐
- openerp学习笔记 视图更新时删除已存在的菜单或其他对象
- Linux(文件系统+其他)学习参考链接收藏
- python 条件,循环和其他语句的学习笔记
- [django每日学习14.11.7]关于django runserver创建的网站其他计算机无法访问
- 安卓学习-其他-网络状态工具
- 个人学习C++过程中对const的总结:初始化系列之用字面值常量与其他类型的值初始化的区别(一)
- python3学习笔记:3.其他部分
- css3学习 理论之其他
- HTML学习13:其他常见标签之体标签
- bootstrap框架学习笔记五(其他部件)
- 其他方面的学习
- Kotlin学习笔记5-4 其他-类型检查与转换
- Linux学习之CentOS(四)----Linux文件属性、所有者、群组、其他组及文件权限操作简要总结
- C标准库学习之<ctype.h> ——字符处理
- 最小二乘法学习(分享自其他博主)
- Python基础教程学习笔记----第五章 条件、循环和其他语句
- C标准库学习之<stddef.h> ——定义部分宏
- 黑马训练营热身课程学习笔记1-其他对象(System)
- 综合集成学习框架及其他机器学习类型
- 学习Mysql过程中拓展的其他技术栈:Docker入门介绍