StrInitCopy

Table of Contents

StrInitCopy

Description

Copy data from src to dst

Parameters

NameDirectionDescription
dstoutStr object to copy into.
srcinStr object to copy from.

Success

true

Failure

false

Usage example (Cross-references)

    }
    
    bool StrInitCopy(Str *dst, const Str *src) {
    ValidateStr(src);
    
    dst->type = src->type;
    StrInitCopy(&dst->name, &src->name);
    
    return dst;
    // Test StrInitCopy function
    bool test_str_init_copy(void) {
    WriteFmt("Testing StrInitCopy\n");
    
    Str src = StrInitFromZstr("Hello, World!");
    
    // Copy src to dst
    bool success = StrInitCopy(&dst, &src);
    
    // Validate both strings

Share :