The strerror library function definition is :
char *strerror (int errnum)
It will map the integer errnum argument (which can be the errno value) to an error rmessage and return a pointer to the message.
I don't know how to use errnum, I tried to use it an external variable like errno, but doesn't work.
In the following script,
if (!(df = fopen(data_file, "r")))
{
fprintf(stderr, "(%s) Cannot open %s: %s\n", argv[0], data_file, strerror(errnum));
exit(1);
}
I got the error message, it shows :
'errnum' : undeclared identifier
Who can give me any idea? Thanks.