Development Environment    

Writing Binary Data

The fwrite function writes the elements of a matrix to a file in a specified numeric precision, returning the number of values written. For instance, these lines create a 100-byte binary file containing the 25 elements of the 5-by-5 magic square, each stored as 4-byte integers.

In this case, fwrite sets the count variable to 25 unless an error occurs, in which case the value is less.


  Reading Binary Data Controlling Position in a File