StrRef::Set( char * )
Set a StrRef to reference an existing null-terminated
string.
|
Virtual? |
No |
|
|
Class |
||
|
Arguments |
|
the null-terminated string to reference |
|
Returns |
|
Notes
StrRef::Set() does not copy
the target string; it simply establishes a pointer to it. Be sure that
the StrRef pointing to the target string does not outlive
the target string.
Example
#include <iostream>
#include <stdhdrs.h>
#include <strbuf.h>
int main( int argc, char **argv )
{
char chars[] = "xyz";
StrRef sr;
sr.Set( chars );
cout << "chars[] = \"" << chars << "\"\n";
cout << "sr.Text() returns \"" << sr.Text() << "'\"n";
}
Executing the preceding code produces the following output:
chars[] = "xyz" sr.Text() returns "xyz"