errno question

Posted on 2006-04-08
Last Modified: 2010-04-17
I want to be able to print out the string which describes the error number returned

Note this is not the description returned by strerror, I want to get my hands on EXXXXX in string format.

Question by:nerdmike
    LVL 14

    Expert Comment

    If you want to print the error number, then you can print the value of errno. It already holds the error number!

      printf( "errno = %d, description: %s\n", errno, strerror(errno));


      Nayer Naguib
    LVL 27

    Accepted Solution

    It's possible _only_ by defining your own array of strings like:

    char *errno_str[]={"OK", "EPERM", "ENOENT", ... };

    look to /usr/include/sys/errno.h for all possibilities.
    Also there may be name collision where same integer have two names (like EWOULDBLOCK  == EAGAIN )

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    This is an explanation of a simple data model to help parse a JSON feed
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now