Retrieve a pointer to the internal character buffer for the string, if necessary, truncate or grow its length to exactly match the length specified by nNewLength.
char * GetBufferSetLength( int nNewLength )
This is an LPTSTR pointer to the character buffer of the null-terminated object.
string str( "abcdef" );
char* pstr = str.GetBufferSetLength(3);
pstr = 'A';
out_str(str); //output should be "Abc"
If you use the pointer returned by GetBufferSetLength to change the string contents, you may need to call ReleaseBuffer before using any other string member methods.