How can I get error message for errno value (C language)? For example, I can write such file (errno_messages.h):
#include <errno.h>
char* get_errno_message(void){
switch (errno) {
case 0:
return "";
break;
case EPERM:
return "Operation not permitted";
break;
case ENOENT:
return "No such file or directory";
break;
case ESRCH:
return "No such process";
break;
/* e.t.c. */
default:
break;
}
}
But maybe such function is exists already?
Best Regards
I think what you're looking for is strerror().