1 year ago
#70201
Александр Климук
How to write data in binary form to a file using extract and insert operators in a stream?
Opening a file with fstream:
std::fstream fileStream(obj.path, std::ios::binary | std::ios::in | std::ios::out);
Next, I write data to the file:
fileStream << this->m_path;
fileStream << this->m_name;
fileStream << this->m_owner;
Opening the file, I see the data is not in binary form. Is this only possible using function write?
fileStream.write((char*)&m_owner, sizeof(std::string));
c++
binaryfiles
fstream
binary-data
0 Answers
Your Answer