diff --git a/CMakeLists.txt b/CMakeLists.txt index c876551..9eb5906 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}") set(META_APP_DESCRIPTION "C++ library to read/write passwords from/to encrypted files") set(META_VERSION_MAJOR 5) set(META_VERSION_MINOR 0) -set(META_VERSION_PATCH 3) +set(META_VERSION_PATCH 4) set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON) # add project files diff --git a/io/passwordfile.cpp b/io/passwordfile.cpp index a63bf25..4ebe481 100644 --- a/io/passwordfile.cpp +++ b/io/passwordfile.cpp @@ -589,15 +589,16 @@ void PasswordFile::clear() /*! * \brief Writes the current root entry to a plain text file. No encryption is used. * \param targetPath Specifies the path of the text file. - * \throws Throws ios_base::failure when an IO error occurs. - * \throws Throws runtime_error when no root entry is present. + * \throws Throws std::ios_base::failure when an IO error occurs and std::runtime_error when no root entry is present. */ void PasswordFile::exportToTextfile(const string &targetPath) const { if (!m_rootEntry) { throw runtime_error("Root entry has not been created."); } - fstream output(targetPath.c_str(), ios_base::out); + NativeFileStream output; + output.exceptions(std::ios_base::failbit | std::ios_base::badbit); + output.open(targetPath, std::ios_base::out); const auto printIndention = [&output](int level) { for (int i = 0; i < level; ++i) { output << " ";