Dynamic Minimum width with Format / writefln

Chris Katko ckatko at gmail.com
Wed Oct 3 01:14:24 UTC 2018


On Wednesday, 3 October 2018 at 00:34:33 UTC, Adam D. Ruppe wrote:
> On Wednesday, 3 October 2018 at 00:14:03 UTC, Chris Katko wrote:
>> Except it doesn't work and tries to decode col.width-1 into a 
>> hexadecimal number and only prints that. ("4D6EF6")
>
> That number certainly isn't col.width (unless you have a width 
> of like millions)...
>
> It looks more like a pointer. What is the type of col.name? If 
> it is string, this code should work fine.
>
> I'm guessing it is a char*...

I'm not sure how I made this mistake. But it seems to only show 
up now if I leave .toStringz() with the writefln.

writefln("%-*s<", col.width-1, col.name.toStringz() /* here */);

So maybe I've been staring at code too long tonight and simply 
missed it?



More information about the Digitalmars-d-learn mailing list