StrBuf::operator =( const char * )

Assign a StrBuf from a null-terminated string.

Virtual?

No

 

Class

StrBuf

 

Arguments

const char *buf

(implied) pointer to the first byte of the null-terminated string

Returns

void

 

Notes

Initialize the StrBuf before the assignment.

The length is set to the number of bytes prior to the first null byte in the string.

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

Example

#include <iostream>

#include <stdhdrs.h>
#include <strbuf.h>

int main( int argc, char **argv )
{
    char chars[] = "xyz";
    StrBuf sb;

    sb = chars;   // assign StrBuf from char *

    cout << "chars[] = \"" << chars << "\"\n";
    cout << "sb.Text() returns \"" << sb.Text() << "\"\n";
}

Executing the preceding code produces the following output:

chars[] = "xyz"
sb.Text() returns "xyz"