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

C/C++ API Documentation | 2025.1

# StrRef::StrRef( const char * ) (constructor)

Construct a `StrRef`, referencing an existing string.

Virtual? | No |
Class | `StrRef` |
Arguments | `char *buf` | a null-terminated string to reference
Returns | `StrRef` |

## Notes

If arguments are provided, the constructor calls `Set()` with them.

## Example

Copy

    #include &lt;iostream&gt;

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

    int main( int argc, char **argv )
    {
        char chars[] = "abc";
        StrRef sr = StrRef( chars );

        cout &lt;&lt; "chars[] = \"" &lt;&lt; chars &lt;&lt; "\"\n";
        cout &lt;&lt; "sr.Text() returns \"" &lt;&lt; sr.Text() &lt;&lt; "\"\n";
    }

Executing the preceding code produces the following output:

    chars[] = "abc"
    sr.Text() returns "abc"

Your search for returned results