basic_string::copy

size_type copy(E *s, size_type n, size_type pos = 0) const;

The member function copies up to n elements from the controlled sequence, beginning at position pos, to the array of E, beginning at s. It returns the number of elements actually copied.

See the related sample program.