File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 88#include <stdio.h>
99#include <stdlib.h>
1010#include <string.h>
11+ #include <errno.h>
1112#ifndef _WIN32
1213#include <libgen.h>
1314#endif
@@ -62,7 +63,7 @@ int main(int argc, char** argv)
6263fd = fopen (argv [i ], "rb" );
6364if (fd == NULL )
6465{
65- printf ( "cannot open file: %s\n" , argv [i ]);
66+ fprintf ( stderr , "cannot open file: %s: %s \n" , argv [i ], strerror ( errno ) );
6667return 1 ;
6768 }
6869
@@ -75,12 +76,12 @@ int main(int argc, char** argv)
7576 }
7677if (ferror (fd ))
7778{
78- printf ( "error while reading file: %s\n" , argv [i ]);
79+ fprintf ( stderr , "error while reading file: %s: %s \n" , argv [i ], strerror ( errno ) );
7980return 1 ;
8081 }
8182if (!feof (fd ))
8283{
83- printf ( "not end of file?: %s\n" ,argv [i ]);
84+ fprintf ( stderr , "not end of file?: %s: %s \n" ,argv [i ], strerror ( errno ) );
8485return 1 ;
8586 }
8687
You can’t perform that action at this time.
0 commit comments