Generic string buffer read/write traits

This old thread might be of interest.