Re: How does one get the description of an errno value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux