mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-18 10:17:12 +02:00
19 lines
491 B
C++
19 lines
491 B
C++
#include "aare/utils/ifstream_helpers.hpp"
|
|
|
|
namespace aare {
|
|
|
|
std::string ifstream_error_msg(std::ifstream &ifs) {
|
|
std::ios_base::iostate state = ifs.rdstate();
|
|
if (state & std::ios_base::eofbit) {
|
|
return " End of file reached";
|
|
} else if (state & std::ios_base::badbit) {
|
|
return " Bad file stream";
|
|
} else if (state & std::ios_base::failbit) {
|
|
return " File read failed";
|
|
} else {
|
|
return " Unknown/no error";
|
|
}
|
|
}
|
|
|
|
} // namespace aare
|