Alternative to fwrite in C++ other than fstream and ostream

Pages: 12
closed account (zwA4jE8b)
Thanks guys! All I have experienced so far is writing text to files and extracting integers.
Last edited on
After you learn endiannes (little endian, big endian), I'd advise you too to learn how floats and doubles are stored in 4 or 8 bytes, respectively. Read about the IEEE754 standard for storing floating numbers.

http://www.psc.edu/general/software/packages/ieee/ieee.php

I noticed in your code that you're using sizeof(char) which totally doesn't make sense. The sizeof function returns the size in bytes of the type you're passing. The size of char is 1 byte. For me, at least, I never use the function sizeof with char because it's just a waste. I just used it for doubles and floats and other complicated objects just to be on the safe side :-), so that I won't access memory regions that doesn't belong to my program ;-).

Good luck with learning binary I/O ;-)
Topic archived. No new replies allowed.
Pages: 12