I'm trying to convert a _bstr_t object to a char array. More specifically I've got a preallocated char array, which size I know and I want to copy the _bstr_t in there.
For a while my code looked like this:
  bool ReadCharPtr(_bstr_t const& input, char* output, unsigned int max_len)
  {
    //  THIS CODE IS WRONG !
    const char * temp (input );
    return ::strcpy_s(output, max_len, temp) == 0;
  }
But... I'm not sure and it's not clear in the windows documentation, what happens when I call operator char*() const. Is something allocated in the heap, that I have to deallocate later ?
Is there a way to avoid this step, and actually convert the _bstr_t in character into the preallocated array ? That would avoid allocating chars on the heap for nothing...