Wildfrog's code is still fine, because the memory returned by c_str() is always contiguous. But in a sense, since the string could use non-contiguous memory for internal storage it's potentially very slow to call c_str() and hence you should avoid it.
