It is well defined C++ to pass std::vector to C APIs that expect an output array like so because std::vector is contiguous:
std::vector myArray(a
cStyleAPI(&myArray[0], arraySize);
If your cStyleAPI receives a char* for input, that is what std::string::c_str() is for.
cStyleAPI
std::string::c_str()
If it receives a pre-allocated char* for output, then no. In that case, you should use a std::vector or std::array.
std::vector
std::array