How to get error information on file closing operation

Viewed 47

On linux, the close() function may fail and errno is set. I guess something similar happens on other systems. Is there a way in the standard library to access the error information on a failed file closing operation? For example:

std::fstream fs(path);
fs.close(); // <-- suppose this fails

How do I know what caused the error? (in a portable way if possible)

0 Answers
Related