Because WaveHeader has no pointers in it, only raw memory, assuming it is all in the cpu endianesss and with ``align(1)`` you can slice that block of stack memory and write from that.

```d
file.rawWrite((cast(ubyte*)&wahv)[0 .. WaveHeader.sizeof]);
```

However I would recommend doing it field by field.

A lot more work, but allows you to handle endianness issues and remove alignment concerns. Also changing of field sizes if required.

Same principles as the code above.
  • Problems using r... tososdk via Digitalmars-d-learn
    • Re: Problem... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
    • Re: Problem... Paul Backus via Digitalmars-d-learn

Reply via email to