在linux中获取错误返回信息 &…
来源:互联网 发布:python的未来 编辑:程序博客网 时间:2024/05/16 13:06
#include // void perror(const char *msg);
#include // char *strerror(int errnum);
#include //errno
errno 是错误代码,在 errno.h头文件中;
perror是错误输出函数,输出格式为:msg:errno对应的错误信息(加上一个换行符);
strerror
以下是测试程序:
// p_str_error.c
// perror , strerror 函数 , errno 测试
#include
#include
#include
#include
int main(int argc, char *argv[])
{
}
open失败则会输出:
perror: No such file or directory
strerror: Cannot allocate memory
open成功则会输出:
perror: Success
strerror: Permission denied
- 在linux中获取错误返回信息 &…
- 在linux中获取错误返回信息
- 在linux中获取错误返回信息
- Redis 在Centos Linux&n…
- 错误:-bash: phpstudy:&nbsp…
- 如何在Linux使用Eclipse +&nb…
- FreeTDS实现在unix- Linux&nb…
- 在RELEASE版本中快速定位DATA&nbsp…
- 【原创】 linux Python&…
- 【转载】 linux Python&…
- eclipse 中 Properties&…
- ASP.NET 出现错误 &nbsp…
- 编译错误 --- does&nbsp…
- C# 如何在 Windows&nbsp…
- 让用户在应用中进入 App&nbsp…
- -Linux Kernel SMP&nbsp…
- -Linux Kernel SMP&nbsp…
- Linux 下使用 NMON&nbsp…
- linux中memset的正确用法
- linux管道通信
- linux中open函数使用
- 进程间通信___命名管道(FIFO)
- linux中stdout,stdin,stderr意义
- 在linux中获取错误返回信息 &…
- 我的博客今天0岁52天了,我领取了…
- 成都国嵌-嵌入式linux必修实验手册…
- 季逸超:90后IT少年的“盖茨梦”
- flex WebService, AsyncToken用法
- s3c6410开发板LED驱动程序设计详细…
- S3C6410的启动代码分析 一
- 6410在rvds下编译启动代码报错分析
- 注意:开发环境不同,启动代码不同…