gcc 4.6.0
What does binary data look like? Is it all 1's and 0's.
I was just wondering, as I was talking to another programmer about copying strings and binary data.
Normally, I use strcpy/strncpy functions to copy strings and memcpy/memmove to copy binary data. However, I am just wondering what does it looks like?
Many thanks for any suggestions,
depends on what you're using to view it. here it's in hexadecimal and ASCII:
jcomeau@intrepid:~$ xxd /bin/bash | head -n 10
0000000: 7f45 4c46 0101 0100 0000 0000 0000 0000 .ELF............
0000010: 0200 0300 0100 0000 5021 0608 3400 0000 ........P!..4...
0000020: 345c 0c00 0000 0000 3400 2000 0800 2800 4\......4. ...(.
0000030: 1c00 1b00 0600 0000 3400 0000 3480 0408 ........4...4...
0000040: 3480 0408 0001 0000 0001 0000 0500 0000 4...............
0000050: 0400 0000 0300 0000 3401 0000 3481 0408 ........4...4...
0000060: 3481 0408 1300 0000 1300 0000 0400 0000 4...............
0000070: 0100 0000 0100 0000 0000 0000 0080 0408 ................
0000080: 0080 0408 c013 0c00 c013 0c00 0500 0000 ................
0000090: 0010 0000 0100 0000 c013 0c00 c0a3 1008 ................
here's another way to view it:
jcomeau@intrepid:~$ convert -size 640x$(($(stat -c %s /bin/bash)/640)) \
-depth 8 gray:/bin/bash /tmp/bash.png
jcomeau@intrepid:~$ firefox /tmp/bash.png
Binary data is just a way of saying that it's data which is not text. In other words, it doesn't actually give you a lot of insight as to what the data is, rather it gives you insight as to what the data isn't.
The odd bit is that, in the most technical sense of the words, text is also binary data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With