We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b7bfeb commit 1e62cceCopy full SHA for 1e62cce
libs/libdecrypt/test/src/test.cpp
@@ -15,8 +15,12 @@ void createTestXMLFile(const std::string& filePath) {
15
16
// Function to read the contents of a file into a string
17
std::string readFileToString(const std::string& filePath) {
18
- std::ifstream inFile(filePath);
19
- std::string content((std::istreambuf_iterator<char>(inFile)), std::istreambuf_iterator<char>());
20
- inFile.close();
21
- return content;
+ std::ifstream inFile(filePath, std::ios::binary);
+ if (!inFile) {
+ throw std::runtime_error("Unable to open file: " + filePath);
+ }
22
+
23
+ std::ostringstream ss;
24
+ ss << inFile.rdbuf();
25
+ return ss.str();
26
}
0 commit comments