title: duplicate value when write binary file
body: <p>I read data from binary file, change the data and write data in binary file.</p>
  
  <pre><code>void VolumeData::saveBinary(std::string filePath)
  {
      std::string output_file = filePath + ".bin";
      std::ofstream fs_dst( output_file.c_str(), std::ios::out | std::ios::binary);
      fs_dst.write((char *)&amp;width, sizeof(__int32));
      fs_dst.write((char *)&amp;height, sizeof(__int32));
      fs_dst.write((char *)&amp;depth, sizeof(__int32));
      fs_dst.write((char *)&amp;scaleX, sizeof(float));
      fs_dst.write((char *)&amp;scaleY, sizeof(float));
      fs_dst.write((char *)&amp;scaleZ, sizeof(float));
      fs_dst.write((char *)data,width*height*depth*sizeof(short));
      fs_dst.close();
  }
  </code></pre>
  
  <p>But when I wrote integer values in file (width = 512 and height = 512), they are duplicated in binary file. To see this, I open original and my files in Hex-editor.</p>
  
  <p><img src="https://i.stack.imgur.com/MxVnD.png" alt="Difference between binary files"></p>
  
  <p>UPD: problem was because I wrote shorts as integers.</p>