Skip to content

StrInitCopy

StrInitCopy

Description

Copy data from src to dst

Parameters

Name Direction Description
dst out Str object to copy into.
src in Str object to copy from.

Success

true

Failure

false

Usage example (Cross-references)

Usage examples (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
            KvConfigCompare,                                                                                               \
            KvConfigCompare,                                                                                               \
            StrInitCopy,                                                                                                   \
            StrDeinit,                                                                                                     \
            StrInitCopy,                                                                                                   \
            StrInitCopy,                                                                                                   \
            StrDeinit,                                                                                                     \
            StrInitCopy,                                                                                                   \
            StrDeinit                                                                                                      \
        )
Last updated on