You could do something like:
std::cerr << strerror(errno) << std::endl;
That still ends up calling strerror
, so you're really just substituting one C function for another. OTOH, it does let you write via streams, instead of mixing C and C++ output, which is generally a good thing. At least AFAIK, C++ doesn't add anything to the library to act as a substitute for strerror
(other than generating an std::string
, I'm not sure what it would change from strerror
anyway).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…