Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.2

# StrBuf::Set( const StrPtr * )

Set a `StrBuf` from a pointer to a `StrPtr`.

Virtual? | No |
Class | `StrBuf` |
Arguments | `const StrPtr *s` | pointer to the `StrPtr` instance
Returns | `void` |

## Notes

Initialize the `StrBuf` and the `StrPtr` before calling `Set()`.

Any memory allocated for the `StrBuf`'s `buffer` is separate from the memory for the `StrPtr`'s `buffer`.

## Example

Copy

    #include &lt;iostream&gt;

    #include &lt;stdhdrs.h&gt;
    #include &lt;strbuf.h&gt;

    int main( int argc, char **argv )
    {
        StrRef sr( "xyz" );
        StrPtr *sp = &amp;sr;
        StrBuf sb;

        sb.Set( sp );   // set StrBuf from StrPtr *

        cout &lt;&lt; sp- → Text() returns \" &lt;&lt; sp-&gt;Text() &lt;&lt; "\"\n";
        cout &lt;&lt; "sb.Text() returns \"" &lt;&lt; sb.Text() &lt;&lt; "\"\n";
    }

Executing the preceding code produces the following output:

    sp->Text() returns "xyz"
    sb.Text() returns "xyz"

Your search for returned results