15.10. Binary I/O
Up to this point, we have been discussing and implementing character-based (or ASCII) I/O. The data files we have been working with contain readable character data, which was read from or written to the file a line at a time. Another option when dealing with data persistence is to use what is known as binary I/O, where the data is read from or written to files as individual bytes of data. The advantages of binary I/O include smaller data files, more efficient I/O operations at run time, and files that are "safer" in a sense because they are not human-readable. The disadvantages of binary I/O are that it is somewhat awkward reading character data with binary I/O, and binary files can be platform dependent, making them difficult ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access