Which solution should I use to deep copy some content of a std::string to a char\* over dll boundaries in C++?

* `memcpy(szValue, value.c_str(), value.size())`

or

* `strncpy_s(szValue, strlen(szValue), value.c_str(), value.length())`

Method in dll to call from outside:

```
unsigned int Interface::GetProp(const char* const szName, char* szValue)
{
    // ...

}

```

I tried it also with:

```
std::string value = m_xmlParser.GetNodeValue(propName);
std::vector<char> propValue(value.begin(), value.end());
propValue.push_back('\0');
szValue = &propValue[0];

```

but this is only a shallow copy (after leaving the dll the char\* array is empty)

memcpy and strncpy\_s are not C++ functions, but it is OK to use it here?

Thx