I'm calling a COM function that requires a wchar_t**
argument. What I would like to do is:
wchar_t* arr[3] = {L"str1", L"str2", L"str3"};
What I get back is a const wchar_t**
, which the compiler rejects.
I also tried:
wchar_t* arr[3];
wchar_t p1[] = L"str1";
wchar_t p2[] = L"str2";
wchar_t p3[] = L"str3";
arr[0] = p1;
arr[1] = p2;
arr[2] = p3;
What I get back is wchar_t* (*)[3]
, which the compiler also rejects.
I'm new to C++ and really struggling with how string literals are handled.
ETA: The function I'm trying to use is GetIDsOfNames and the second parameter is where I'm having a problem. I want to pass 3 names in that parameter (I can successfully pass one name with wchar_t ptName[] = L"namestring"
but can't figure out how to combine multiple names in an array).
HRESULT GetIDsOfNames(
REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
DISPID *rgDispId
);