2.2.3.15.28 string::ReleaseBuffer

Description

Use ReleaseBuffer to end use of a buffer allocated by GetBuffer.

Syntax

void ReleaseBuffer( int nNewLength = -1 )

Parameters

nNewLength
[input]The new length of the string in characters, not counting a null terminator. If the string is null-terminated, the <0 default value sets the string size to the current length of the string.

Return

None.

Examples

EX1

void string_ReleaseBuffer_ex1()
{
    string str = "abcdefg";
    char *p = str.GetBuffer( 20 ); 
    p[3] = 'D';  
    str.ReleaseBuffer();
    out_str( str );        //output should be "abcDefg"
}

Remark

See Also

string::GetBuffer

Header to Include

origin.h