StrPushCstr

Table of Contents

StrPushCstr

Description

Push a array of characters with given length into this string at the given position.

Parameters

NameDirectionDescription
strin,outStr to insert array chars into.
cstrinarray of characters with given length to be inserted.
posinPosition to insert at.

Success

str

Failure

NULL

Usage example (Cross-references)

    /// FAILURE : NULL
    ///
    #define StrPushZstr(str, zstr, pos) StrPushCstr((str), (zstr), strlen(zstr), (pos))
    
    ///
    // Test StrPushCstr function
    bool test_str_push_cstr(void) {
    printf("Testing StrPushCstr\n");
    
    Str s = StrInitFromZstr("Hello");
    
    // Push a string at position 2
    StrPushCstr(&s, " World", 6, 2);
    
    // Check that the string was inserted correctly

Share :