wchar[] and wchar*
    Sergey Gromov 
    snake.scaly at gmail.com
       
    Tue Apr  7 07:39:35 PDT 2009
    
    
  
Tue, 07 Apr 2009 01:32:59 -0400, novice2 wrote:
> hi!
> could you advice me, please, what techniques should be used
> while working with D wchar[] and C wchar* (e.g. Windows unicode API named ...W()).
> 
> how to pass wchar[] to FuncW(wchar*) and back?
Since most of FuncW require not only the pointer but length as well, you
usually call them like this:
  wchar[] foo = "some string";
  FuncW(foo.ptr, foo.length);
To get a string from a function you need a buffer:
  auto buf = new wchar[MAX_PATH];
  buf.length = GetModuleFileNameW(h, buf.ptr, buf.length);
    
    
More information about the Digitalmars-d-learn
mailing list