#include #include #include extern int sys_nerr; extern int errno; int main() { char buffer[4]; for (errno = 0; errno < sys_nerr; ++errno) { sprintf(buffer, "%3d", errno); perror(buffer); } exit(0); /* There is not an error message for 0 and there's no point in * having one. since 0 is used for successful completion. If the * program terminated correctly the 0 value is enough and * there's no need for explanations... */ }