C examples for string.h:strerror
function
<cstring> <string.h>
Interprets the value of errnum, generating a string that describes the error condition.
char * strerror ( int errnum );
Parameter | Description |
---|---|
errnum | Error number. |
A pointer to the error string describing error errnum.
#include <stdio.h> #include <string.h> #include <errno.h> int main ()/* www .j a v a 2 s . co m*/ { FILE * pFile; pFile = fopen ("unexist.ent","r"); if (pFile == NULL) printf ("Error opening file unexist.ent: %s\n",strerror(errno)); return 0; }