It would be helpful if the description mentioned that \0 is added to the end of the buffer.
It might be better for people unfamiliar with char arrays. I can raise an issue for you.
If you do not need a copy of the data, just use string.c_str(). It will save a lot of overhead.
char *ptr = string.c_str();