string from C function - to!string

Nick Treleaven nick at geany.org
Fri May 16 12:23:24 UTC 2025


On Friday, 16 May 2025 at 09:42:20 UTC, Kagamin wrote:
> On Wednesday, 14 May 2025 at 11:38:59 UTC, Nick Treleaven wrote:
>> So `to!string` is bad for generic code. Want to represent the 
>> address of a byte* as hex in a string, fine. Oh now the 
>> pointer's element type is char - wait, why isn't the result 
>> hex any more?
>
> try `to!(string,void*)`?

This works, but it relies on an undocumented template parameter 
AFAICS:
```d
     char c;
     alias tos = to!string;
     tos!(void*)(&c).writeln;
```


More information about the Digitalmars-d-learn mailing list