Endian correctness confusion

the example below, should generate the same file, on big- and little-endian processers, right?

const char * const chunk=“abcd”;
FileOutputStream o(f);
o.write (chunk,4);

Am i right?

Endianness only matters when treating memory as a built in type larger than 1 byte. For example, a short, a long, or a double. Since the version of write() you are calling is dealing with bytes, endianness shouldn’t matter.

Thanks. I was a little confused why the WAV-Format Chunks are saved so complicated (as integers), maybe because of easier comparison. (But finally i get it :slight_smile:

inline int chunkName (const char* const name) noexcept { return (int) ByteOrder::littleEndianInt (name); }
out.writeInt (chunkName (“ltxt”));