fwrite(&xmem, 1, sizeof(xmem), pFile);
Assuming you are on 32-bit windows, you write:
4 bytes containing the address of meshSys
4 bytes containing the address returned by adjBuffer->GetBufferPointer()
4 bytes containing the address returned by mtrlBuffer->GetBufferPointer()
4 bytes containing the DWORD X_numMtrls
On 64-bit Windows each of the addresses will be 8 bytes.
sizeof(xmem) evaluates to the size of the Xfile struct in bytes.
Usually I would use
D3DXSaveMeshToX[
^] to accomplish this task.
Best regards
Espen Harlinn