money
tom
trodg43 at edq.eu
Tue May 11 23:59:32 UTC 2021
{
import std.algorithm, std.stdio, std.file, std.range;
enum cols = 14;
// Split file into 14-byte chunks per row
thisExePath.File("rb").byChunk(cols).take(20).each!(chunk =>
// Use range formatting to format the
// hexadecimal part and align the text part
writefln!"%(%02X %)%*s %s"(
chunk,
3 * (cols - chunk.length), "", // Padding
chunk.map!(c => // Replace non-printable
c < 0x20 || c > 0x7E ? '.' : char(c))));
}
More information about the Digitalmars-d
mailing list