Binary Files (raw bytes)

Let's find out how C reads and writes binary data files.

There are many circumstances in which you may want to read from and write to binary files. Binary files are not plain text (ASCII) files where each chunk of bytes represents an ASCII character. In binary files, you store raw bytes, in whatever format you want.

Advantages of binary files over ASCII files are as follows:

  • They are typically smaller in size.
  • They can be read from and written to faster (no need to convert between raw bytes and ASCII characters).

Disadvantages of binary files are that they are not human-readable (you can’t open in them in a text editor and “look” at them).

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy