Is there a way to make a std::string from a char* without copying it? If I understand correctly using the = operator will copy a c-string to a std::string. Using std::string constructor will again do the same. Is there a way to assign the internal char array of std::string to a char* or char[]?

I am just looking for a method that I can use a std::string when a c-method asks for a char* to right on. If it asks to read, this is solved with string.c_str(). But I am kind of confused about how to write on a std::string instead of a char*.

I don't want the copy just because of the added time needed. A memset() hack could be available, but it would depend on how std::string is implemented (where its internal char array is located)