The easiest way is to use ATL::CComSafeArray. Assume you have a pointer to safe array in variable pSa,
CComSafeArray<BSTR> array;
array.Attach(pSa);
for(int i=0; i< array.GetCount(); ++i)
{
std::wcout << (const wchar_t*) array[i] << std::endl;
}
If you want to use just win32,
SafeArrayLock(pSa);
LONG uBound = -1, lBound = 0;
SafeArrayUBound(pSa,1,uBound);
SafeArrayUBound(pSa,1,lBound);
int nCount = uBound - lBound + 1;
for(int i = 0; i<nCount; ++i)
{
std::wcout << ((BSTR*)(pSa->pvData))[i] << std::endl;
}