How to handle char* to string from C functions?

Gary Willoughby dev at nomad.so
Thu Jan 2 08:02:18 PST 2014


On Thursday, 2 January 2014 at 15:31:25 UTC, bearophile wrote:
> Gary Willoughby:
>
>> Another question: how do i convert const(char)** to string[]?
>
> If you know that you have N strings, then a solution is 
> (untested):
>
> pp[0 .. N].map!text.array
>
> If it doesn't work, try:
>
> pp[0 .. N].map!(to!string).array
>
> Bye,
> bearophile

Thanks, both work well:

I've noticed that const(char)** can be accessed via indexes:

writefln("%s", pp[0].to!(string)); //etc.

cool!


More information about the Digitalmars-d-learn mailing list