errno perror strerror strerror_r
来源:互联网 发布:淘宝直通车收费贵 编辑:程序博客网 时间:2024/06/04 18:36
http://man7.org/linux/man-pages/man3/errno.3.html
1、当系统调用或一些C库函数出错时,设置errno。
2、errno永远不会被系统调用或库函数设置为0.
调用成功时,errno行为未知,可能被修改。
3、一般情况下,系统调用或库函数出错时,返回-1或NULL。
但有些情况下,返回-1就是正常值,如getpriority,这是需要先把errno设置为0,再调用函数,然后再根据errno是否改变来判断是否出错。
4、不要用自己声明,包含头文件
#include <errno.h>
5、errno是线程安全的。
6、printf也可能修改errno,所以记得存储临时值。
7、void perror(constchar *s); 先打印s,然后冒号和空格,再打印error信息。此函数出错也设置errno。
8、#include <string.h>
char *strerror(int errnum);
9、int strerror_r(interrnum,char *buf,size_t buflen); /* XSI-compliant */
char *strerror_r(interrnum,char *buf,size_t buflen); /* GNU-specific */ 此函数线程安全
这2个函数返回值不确定!!!实现千变万化,慎用,使用时请仔细看文档!!!
- errno perror strerror strerror_r
- strerror & errno & perror
- errno , perror,strerror
- perror函数,strerror函数,errno
- perror函数,strerror函数,errno
- errno perror strerror的使用
- perror函数,strerror函数,errno
- perror函数,strerror函数,errno
- strerror, strerror_r
- 关于errno与perror,strerror函数
- perror, errno, strerror 三个函数的说明
- perror函数,strerror函数,errno,stderr
- 关于errno与perror,strerror函数
- errno、stderr、perror函数和strerror函数
- 关于errno与perror,strerror函数
- 关于errno与perror,strerror函数
- 玩玩linux下的errno, perror, strerror
- errno、stderr、perror函数和strerror函数
- mysql里面的时间函数
- Spring中EmptyResultDataAccessException异常的处理方法
- shell逻辑运算
- C++中虚函数的实现背后
- ubuntu下通过ufw配置nat
- errno perror strerror strerror_r
- centso5下使用coreseek(sphinx)建立搜索引擎
- /etc/profile 续
- HDU 1702 stack queue 的应用 大水题
- oracle control_files的创建
- 我自己的signal / slot实现
- sk_buff 里的len, data_len, skb_headlen
- Movie collection
- 内存池