core.exception.UnicodeException at src\rt\util\utf.d(400): illegal UTF-16 value
    notna via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Tue Sep 16 12:44:47 PDT 2014
    
    
  
Thanks Ali.
As always, your examples and explanations are amazingly clear and 
"easy to understand".
On Monday, 15 September 2014 at 23:57:59 UTC, Ali Çehreli wrote:
> You must make use of the returned value to slice your wstring. 
> Something like this (not compiled):
>
>     auto actualLength = GetUserNameW(lpwszUsername.ptr, 
> &dUsername2);
>     auto userName = lpwszUsername[0..actualLength];
>
> Otherwise, D knows that lpwszUsername is a 254-char string and 
> will try to print all of it.
>
> Ali
    
    
More information about the Digitalmars-d-learn
mailing list