On Sun, Mar 15, 2009 at 7:43 AM, Tiago Maluta <maluta_tiago@xxxxxxxxxxxx> wrote: > Steve, > >> 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 */ >> > > I've searched in headers on /usr/include for MAX_ERRNO but not found. > Where MAX_ERRNO is defined? you could define it with something like this: #ifndef MAX_ERRNO #define MAX_ERRNO 4095 #endif Sergio > > A *very* simple workaround was check for "Unknown" word, so I tried: > > int main(void) { > int i=0; > extern int errno; > char str[128]; > > while (strncmp(str,"Unknown",7)) { > sprintf(str,"%s",strerror(i)); > fprintf(stderr, "%3d", i); > errno = i; > perror(" "); > i++; > } > > return (0); > } > > > But there is "Unknown" between valid error messages. > I think there is a better way to do it.... > > > Best regards, > > --tm > -- 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