Binary Files
- Updated2026-05-01
- 2 minute(s) read
Binary files store numeric data in a compact, fixed-size binary format for fast file I/O and random access. Binary files save disk space by avoiding text conversion, but they are machine readable only.
Storing binary data, such as an integer, uses a fixed number of bytes on disk. For example, storing any number from 0 to 4,000,000,000 in binary format, such as 1, 1,000, or 1,000,000, takes up 4 bytes for each number.
Use binary files for the following:
- To save numeric data
- To access specific numbers from a file or randomly access numbers from a file
Binary files are more efficient than text files:
- Binary files use less disk space
- Unlike text, you do not need to convert binary data to and from a text representation when you store and retrieve data
Binary files are machine readable only, unlike text files, which are human readable. Binary files are the most compact and fastest format for storing data. You can use multiple data types in binary files, but this is uncommon.
A binary file can represent 256 values in 1 byte of disk space. Often, binary files contain a byte-for-byte image of the data as it was stored in memory. When the file contains a byte-for-byte image of the data, reading the file is faster because conversion is not necessary. Binary files cannot represent cases like extended and complex numeric values with byte-for-byte images.
Use the File I/O VIs and functions to read from and write to binary files. Consider using the binary file functions if you want to read numeric data from or write numeric data to a file or if you want to create text files for use on multiple operating systems.
Binary File I/O Examples
Refer to Simple Binary File.lvproj in the labview\examples\File IO\Binary\Simple Binary directory for examples of:
- Reading an array of double-precision floating-point values from a file
- Writing an array of double-precision floating-point values to a file