This project provides sample code that demonstrates writing binary data to a file using the C language. Use the hexdump
command (or a GUI hex editor such as Hex Fiend) to view and the data it generates.
This should be buildable with the
Be sure you have the XCode CommandLine Tools (or full XCode) installed. GNU tools should also work but have not been tested.
If you don't have the command line tools installed, they can be installed with the following command:
xcode-select --install
- Clone the repo
git clone https://github.com/Ada-C19/binary-data.git
- Compile the code
- Either use the provided
Makefile
by runningmake
- Or compile manually with
clang -o binary-data main.c
- Either use the provided
Debug builds can be made by running
make debug
or
clang -g -o binary-data main.c
After building the program, run it with
./binary-data
Then, inspect the generated data.bin
file using a hex editor. The built-in hexdump
command can be used for this purpose.
hexdump -C data.bin