[your code here] HexViewer
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Wed Aug 2 14:58:18 PDT 2017
On Wed, Aug 02, 2017 at 09:59:23PM +0000, Vladimir Panteleev via Digitalmars-d wrote:
> On Wednesday, 2 August 2017 at 19:39:18 UTC, Andre Pany wrote:
> > This application opens the file passed as argument and display the
> > content in hex and text format:
>
> Good idea! But I think it needs more ranges:
>
> void main(string[] args)
> {
> import std.algorithm, std.format, std.stdio;
> enum cols = 16;
> args[1].File("rb").byChunk(16).map!(chunk =>
> format!"%(%02X %)%*s %s"(
> chunk,
> 3 * (cols - chunk.length), "",
> chunk.map!(c =>
> c < 0x20 || c > 0x7E ? '.' : char(c))))
> .each!writeln;
> }
Whoa. This is cool and everything, but it also looks pretty intimidating
for a newcomer to D. I'm not sure if we should put this on the front
page!
T
--
Democracy: The triumph of popularity over principle. -- C.Bond
More information about the Digitalmars-d
mailing list