diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -8,6 +8,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <errno.h> #ifndef _WIN32 #include <libgen.h> #endif @@ -62,7 +63,7 @@ int main(int argc, char** argv) fd = fopen(argv[i], "rb"); if (fd == NULL) { - printf("cannot open file: %s\n", argv[i]); + fprintf(stderr, "cannot open file: %s: %s\n", argv[i], strerror(errno)); return 1; } @@ -75,12 +76,12 @@ int main(int argc, char** argv) } if (ferror(fd)) { - printf("error while reading file: %s\n", argv[i]); + fprintf(stderr, "error while reading file: %s: %s\n", argv[i], strerror(errno)); return 1; } if (!feof(fd)) { - printf("not end of file?: %s\n",argv[i]); + fprintf(stderr, "not end of file?: %s: %s\n", argv[i], strerror(errno)); return 1; } |