It is not possible to pass the entire vector to an array of pointer pointers. You can handle the active part of vector as if it were an array of vector elements, but in this case it would be an array of string objects, not a pointer to char* . Trying to interpret it as anything else will be undefined.
If you are sure that the API will not touch the contents of char* strings (for example, since it is const -qualified), you can create an array of pointers and put the results of calls in c_str() on vector elements in it, for example:
char **pList = new char*[oList.size()]; for (int i = 0 ; i != oList.size() ; i++) { pList[i] = oList[i].c_str(); } myTrippleStarFunction(&pList);
However, you need to be very careful when passing an array of APIs that uses an extra level of indirection, because changing the pointer you pass may require the third asterisk to change, for example, reallocating the array. In this case, you may need to use a different mechanism for allocating dynamic memory according to the mechanism used by your API.
source share