Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ convert const char* to LPCWSTR

  const char *p = "D:";
  const WCHAR *pwcsName; //LPCWSTR
  
  // required size
  int size = MultiByteToWideChar(CP_ACP, 0, p, -1, NULL, 0);
  // allocate it
  pwcsName = new WCHAR[nChars];
  MultiByteToWideChar(CP_ACP, 0, p, -1, (LPWSTR)pwcsName, size);
  // use it....
    
  // delete it
  delete [] pwcsName;
}
Source by www.codeproject.com #
 
PREVIOUS NEXT
Tagged: #convert #const #LPCWSTR
ADD COMMENT
Topic
Name
4+2 =