How to convert errno in UNIX to corresponding string?

后端 未结 6 1492
悲哀的现实
悲哀的现实 2020-12-16 08:57

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

6条回答
  •  时光说笑
    2020-12-16 09:43

    Just another solution that solves exactly the problem you have, but in Python instead of C:

    >>> import errno
    >>> errno.errorcode[errno.EIDRM]
    'EIDRM'
    

提交回复
热议问题