Common Problems with Binary Files



A good answer might be:

Not in general.

Common Problems with Binary Files

If the data is expected to fall into a known range of values,
then a program can check for valid input values.
Sometimes other things are known about the data
that can be used to check it.
But otherwise, there is usually no way to check.
Bytes written in one format can usually
be mistakenly read with another.
You have to be sure that the data file and the program match.

This is a common problem in programming.
Some files are many years old and were
created with poorly documented programs that ran
on now obsolete computers.
Figuring out how to read them is often a
case of detective work.

Often a file will have a header that describes
its data.
This is common for image files, for example.
A program that reads the file checks the header to
verify that the file is what is expected.
It is common for the header to include
additional information such as the
date of its creation and the
version
number of the program that created it.

QUESTION 5:


(Thought question: ) Why are binary files used if they
have these problems?