What's the difference between std::string::c_str and std::string::data?

c++, c-str, stdstring

Solution

c_str() guarantees NUL termination. data() does not.

Problem

Why would I ever want to call `std::string::data()` over `std::string::c_str()`? Surely there is some method to the standard's madness here...

Original source

Related problems