The following code is supposed to write a 2D array (quad_array) to a binary file. The code creates the file (quads.dat) but does not write anything to it (0 bytes).
XMFLOAT3 * quad_array;
quad_array = new XMFLOAT3 * [quad_width];
for (unsigned int x = 0; x < quad_width; x++) {
quad_array[x] = new XMFLOAT3[quad_height];
}
// ... fills quad_array with data...
ofstream ofs("quads.dat", std::ofstream::binary);
ofs.open("quads.dat");
streamsize size = sizeof(XMFLOAT3)*quad_height*quad_width;
ofs.write((char*)&quad_array[0][0], size);
ofs.close();