Create a console program to display each byte of a file.
Since this is code-golf, fewest bytes wins.
- Program must be a console application, meaning that it will be ran from some sort of command-line interpreter;
- Every byte must be uppercase hexadecimal, separated by a space, and it must be 2 digits; (put number 0 before it if it has 1 digit)
- File must be read using IO or alternative, and not hard-coded;
- File path must be specified as a command-line argument or a user prompt (like STDIN);
- No loopholes please;
test.txt (ends with LF)
$ ./hexdump.exe test.txt 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 0A
hello.txttext file as an example as an input and what the expected output should be. For instance, if the
hello.txtcontained simply the word
hellowith a line break, how would this be expressed in the output? Are you grouping the bytes in 16-bit,32-bit or 64-bit words? Or is each byte expressed as two-digit hex? Are spaces acceptable after each byte as hex, or after each x-bit word? Do you require an
0xpre-fix for each byte? \$\endgroup\$