14.5 BINARY FILES

Earlier we have said that binary files are important because they are smaller in size and can be processed faster than corresponding text files. Binary files consist of bytes. Consider a case of a float value 123.45678. If we store it in a text file it will need 9 bytes. While reading this value, computer has to convert this string in to a float number. It needs some instructions. If we store this value in binary file it will need only four bytes. When computer reads these bytes, it loads them directly in to RAM memory. No conversion is required. We may say that in binary file we store memory images of variables.

Useful binary files consist of some component. By component, we mean either a simple data type or a structure or ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.