如何将 UNIX 中的 errno 转换为相应的字符串? [英] How to convert errno in UNIX to corresponding string?

查看:82
本文介绍了如何将 UNIX 中的 errno 转换为相应的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UNIX 中是否有任何函数可以将 errno 转换为其相应的字符串,例如EIDRM 到EIDRM".调试以检查这些整数 errnos 的错误非常烦人.

Is there any function in UNIX to the convert errno to its corresponding string for e.g. EIDRM to "EIDRM". Its very annoying to debug to check for errors with these integer errnos.

推荐答案

strerror() 应该这样做.http://linux.die.net/man/3/strerror

仅供参考,这样您自己就可以更轻松地找到这些内容:如果您输入 man errno(或您正在研究的任何函数),然后查看手册页的最底部,您将看到一个列表相关功能.如果你man每一个(根据他们的名字猜测先做哪一个),你通常会找到类似问题的答案.

FYI, so that you can find these things more easily, yourself: If you type man errno (or whatever function you're investigating), and look at the very bottom of the man page, you'll see a list of related functions. If you man each of those (taking a guess about which one(s) to do first based on their names) you'll often find the answer to similar questions.

这篇关于如何将 UNIX 中的 errno 转换为相应的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆