linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Graegert <graegerts@gmail.com>
To: Angel Tsankov <fn42551@fmi.uni-sofia.bg>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: How does one get the description of an errno value
Date: Sun, 15 Mar 2009 12:20:44 +0100	[thread overview]
Message-ID: <6a00c8d50903150420ke10afcfs7c78a11355c5957a@mail.gmail.com> (raw)
In-Reply-To: <gpim9l$dia$1@ger.gmane.org>

Angel,

The following code snippet should do it.  It basically sets errno
manually and outputs the associated error message.

--- BEGIN ---

#define _ALL_SOURCE

#include <stdio.h>
#include <errno.h> /* for _MAX_ERRNO */

int main(void) {
	int i;
	extern int errno;
	
	for (i = 0; i < MAX_ERRNO; i++) {
		fprintf(stderr, "%3d", i);
		errno = i;
		perror(" ");
	}
	
	return (0);
}

--- END ---

	\Steve

--

Steve Graegert
www.graegert.com



On Sun, Mar 15, 2009 at 11:46 AM, Angel Tsankov
<fn42551@fmi.uni-sofia.bg> wrote:
> Hello,
>
> Is there a function which returns the description of an errno value and, if
> so, which is it?
>
> Regards,
> Angel Tsankov
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2009-03-15 11:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-15 10:46 How does one get the description of an errno value Angel Tsankov
2009-03-15 11:20 ` Bert Wesarg
2009-03-15 11:20 ` Steve Graegert [this message]
2009-03-15 10:43   ` Tiago Maluta
2009-03-15 13:09     ` Sergio Luis
2009-03-15 13:10     ` Steve Graegert
     [not found]     ` <a913862f0903150619o43657d87q2f45dbdbc7071659@mail.gmail.com>
     [not found]       ` <49BD1E25.4010305@yahoo.com.br>
2009-03-15 18:13         ` Akos Marton
2009-03-16  1:23   ` Jon Mayo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a00c8d50903150420ke10afcfs7c78a11355c5957a@mail.gmail.com \
    --to=graegerts@gmail.com \
    --cc=fn42551@fmi.uni-sofia.bg \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).