r/learncpp • • Aug 23 '21

endianness

When writing numbers to files using ofstream, on my little endian machine those numbers are written in little endian, but I assume that for big endian machines those numbers are written in big endian, I want to be certain ofstream doesn't handle endianness for me. Also how do you suggest I safely write to files?

4 Upvotes

13 comments sorted by

View all comments

Show parent comment

1

u/IamImposter Aug 23 '21

You are right. Sometimes I just overthink (or underthink) and confuse myself.