[your code here] HexViewer
Andre Pany via Digitalmars-d
digitalmars-d at puremagic.com
Wed Aug 2 20:39:19 PDT 2017
On Wednesday, 2 August 2017 at 22:02:49 UTC, Vladimir Panteleev
wrote:
> On Wednesday, 2 August 2017 at 21:59:23 UTC, Vladimir Panteleev
> wrote:
>> Good idea! But I think it needs more ranges:
>
> The format call can be substituted with writefln directly:
>
> void main(string[] args)
> {
> import std.algorithm, std.format, std.stdio;
> enum cols = 16;
> args[1].File("rb").byChunk(16).each!(chunk =>
> writefln!"%(%02X %)%*s %s"(
> chunk,
> 3 * (cols - chunk.length), "",
> chunk.map!(c =>
> c < 0x20 || c > 0x7E ? '.' : char(c))));
> }
Really cool:)
Kind regards
André
More information about the Digitalmars-d
mailing list