This line:
file_write.write((char*)&structure_data,sizeOfStructure);
takes whatever structure_data is, and just copies those blob of bytes that makes up structure_data to a file.
It doesn't figure out what the members are. Also, this is the cause for thousands of SO questions that erroneously do coding like this, where structure_data cannot be written to a file this way and have the file contents make sense. It is quickly discovered that the contents of the file are useless when an attempt to read back the data into a program
is unsuccessful.
Most of the time in those scenarios structure_data would contain pointers, or members that are not C-layout compatible, i.e. non-POD types such as std::string or std::vector, that basically renders this technique of writing to a file like this totally useless (and invalid).
Look up object serialization such as this link on the topic
structure_datais, and just copies those blob of bytes to a file. It doesn't figure out what the members are. Also, this is the cause for thousands of SO questions that erroneously do codiing like this, wherestructure_datacannot be written to a file this way and have the file make sense. Look up object serialization.writealso takes achar*, so you are converting tochar*here, which IIRC results in implementation-defined behavior.<<for each item.