Skip to content

StrInsertZstr

StrInsertZstr

Description

Insert a zero-terminated string into given Str at given index.

Parameters

Name Direction Description
str in,out Str object to insert into.
zstr in Zero-terminated string to be inserted.
idx in Index to insert the string at.

Success

return

Failure

Does not return

Usage example (Cross-references)

Usage examples (Cross-references)
                    char  *zstr = generate_cstring(data, offset, size, 20);
                    if (zstr) {
                        StrInsertZstr(str, zstr, idx);
                        free(zstr);
                    }
    // Test StrInsertZstr function
    bool test_str_insert_zstr(void) {
        WriteFmt("Testing StrInsertZstr\n");
    
        Str s = StrInitFromZstr("Hello");
    
        // Insert a string in the middle
        StrInsertZstr(&s, " World", 2);
    
        // Check that the string was inserted correctly
Last updated on