fix: write/read file as binary
This commit is contained in:
@@ -64,7 +64,7 @@ std::ostream& operator<<(std::ostream& os, const DataBuffer& buffer) {
|
||||
|
||||
bool DataBuffer::ReadFile(const std::string& fileName) {
|
||||
try {
|
||||
std::ifstream file(fileName);
|
||||
std::ifstream file(fileName, std::istream::binary);
|
||||
std::ostringstream ss;
|
||||
ss << file.rdbuf();
|
||||
const std::string& s = ss.str();
|
||||
@@ -79,7 +79,7 @@ bool DataBuffer::ReadFile(const std::string& fileName) {
|
||||
|
||||
bool DataBuffer::WriteFile(const std::string& fileName) {
|
||||
try {
|
||||
std::ofstream file(fileName);
|
||||
std::ofstream file(fileName, std::ostream::binary);
|
||||
file.write((const char*)m_Buffer.data(), m_Buffer.size());
|
||||
file.flush();
|
||||
} catch (std::exception& e) {
|
||||
|
||||
Reference in New Issue
Block a user