I'd like to wrap few C functions for safe C++ usage. There is a C function which takes raw pointer to array and its size, like -
void function(char* bufferToFill, size_t bufsize)
And now, I am having trouble finding C++ object which can expose a raw pointer to be passed to such function. I would like to avoid using new[] and keeping in mind to delete[] it every time I throw an exception.
std::string obviously cant expose its char*, std::vector similar, the only thing that comes to my mind is std::unique_ptr but it feels kinda odd (because its usually used to own an object, not array?)
Whats the proper C++ way to solve such problem? Thanks in advance