Why not write a function for this:
string ErrStr() {
char * e = strerror(errno);
return e ? e : "";
}
It is easy to use, self-documenting, can be adapted to reformat the output and covers the possibility that strerror () can return NULL (I don't know if it can).
anon
source
share