When I write a struct to file, how the memory sets up in the file? For instance this struct and function:
struct vector3D
{
public:
float x, y, z;
vector3D(float modelX, float modelY, float modelZ)
{
x = modelX;
y = modelY;
z = modelZ;
}
vector3D()
{
x = 0;
y = 0;
z = 0;
}
}
inline void writeVector3D(vector3D vec, FILE *f)
{
fwrite((void*)(&vec), sizeof(vector3D), 1, f);
}
And this code in main:
vector3D vec(1, 2, 3);
writeVector3D(vec, file);
How does the information sets up in the file? does it like 123
?
Or struct has different set up?