Created
February 7, 2013 23:05
-
-
Save jsteemann/4735049 to your computer and use it in GitHub Desktop.
small helper program to print the error messages for integer system error codes. use as follows:
./dumperror <code>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
small helper program to print the error messages for | |
integer error codes. use as follows: | |
gcc -Wall -Wextra -pedantic dumperror.c | |
./dumperror <code> | |
where code is the error number you're interested in | |
*/ | |
#include <errno.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main (int argc, char* argv[]) { | |
int code; | |
if (argc != 2) { | |
fprintf(stderr, "usage %s <code>\n", argv[0]); | |
exit(1); | |
} | |
code = (int) atoi(argv[1]); | |
printf("%s\n", strerror(code)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment