Prior to C++11 the data storage of std::string was not guaranteed to be contiguous so you could not (officially[1]) use the operator[] plus address-of trick -- e.g. &example[0] -- you had to use string::c_str() or string::data() to get a char* pointer to a valid C string. Of course, you can use operator or a per-char basis, as ResidentBiscuit suggested. Or an iterator.
You could also use std::copy algorithm to copy from the string into a buffer.
Andy
[1] Some implementations did use contiguous storage.