De-Referencing A Pointer

Regan Heath regan at netwin.co.nz
Tue Mar 21 00:30:46 PST 2006


On Tue, 21 Mar 2006 09:00:15 +0100, Oskar Linde  
<oskar.lindeREM at OVEgmail.com> wrote:
> Rory Starkweather skrev:
>> Still working on a VB to D DLL interface. I want to pass a string to a D
>> function. The only way I have been able to do it without errors is  
>> ByRef on the
>> VB end, as expected, to a char* on the D end. However, I want to use  
>> the 'find'
>> function on the string. 'find' requires a char[] and a dchar as inputs.  
>> I
>> I haven't been able to figure out how to de-reference the pointer for  
>> the char[]
>> and I don't know how to produce a dchar.
>
> a char* cStr is converted to char[] by
>
> cStr[0..std.c.string.strlen(cStr)]
>
> or
>
> std.string.toString(cStr)

and you can get a dchar with std.utf.toUTF32().

Regan



More information about the Digitalmars-d-learn mailing list