GetBufferSetLength
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.
EX1
void string_GetBufferSetLength_ex1() { string str( "abcdef" ); char* pstr = str.GetBufferSetLength(3); pstr[0] = '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.
string::GetBuffer
origin.h