Conversion Between C++ and C Strings
While the conversion of a C string in a C++-string id done implicitly, you must explicitly request the conversion from a C++-string into a C string. str.copy()
copies the content of a C++-string without the terminating \0
character. str.data()
and str.c_str()
includes the terminating null character.