Skip to content
StrPushBackCstr

StrPushBackCstr

StrPushBackCstr

Description

Push an array of chars with given length to the back of this string.

Parameters

Name Direction Description
str in,out Str to insert array chars into.
cstr in array of characters with given length to be inserted.

Success

str

Failure

NULL

Usage example (Cross-references)

Usage examples (Cross-references)
                    char *cstr = generate_cstring(data, offset, size, 20);
                    if (cstr) {
                        StrPushBackCstr(str, cstr, strlen(cstr));
                        free(cstr);
                    }
                    char *cstr = generate_cstring(data, offset, size, 20);
                    if (cstr) {
                        StrPushBackCstr(str, cstr, strlen(cstr));
                        free(cstr);
                    }
                char c2    = low < 10 ? '0' + low : is_caps ? 'A' + (low - 10) : 'a' + (low - 10);
                char cs[3] = {'\\', c1, c2};
                StrPushBackCstr(o, cs, 3);
            }
            vs++;
            dot = strchr(body, '.');
            if (!dot) {
                StrPushBackCstr(&result, body, ZstrLen(body));
    
                if (precision > 0) {
            frac   = (u64)ZstrLen(dot + 1);
    
            StrPushBackCstr(&result, body, prefix);
            if (precision > 0) {
                StrPushBack(&result, '.');
            if (precision > 0) {
                StrPushBack(&result, '.');
                StrPushBackCstr(&result, dot + 1, MIN2(frac, (u64)precision));
                for (u32 i = (u32)MIN2(frac, (u64)precision); i < precision; i++) {
                    StrPushBack(&result, '0');
            ssize_t n = read(rfd, tmpbuf, 1023);
            if (n > 0) {
                StrPushBackCstr(buf, tmpbuf, n);
                total_read += n;
            } else if (n == 0) {
            }
    
            StrPushBackCstr(buf, tmpbuf, bytes_read);
            total_read += bytes_read;
        }
    // Test StrPushBackCstr function
    bool test_str_push_back_cstr(void) {
        WriteFmt("Testing StrPushBackCstr\n");
    
        Str s = StrInitFromZstr("Hello");
    
        // Push a string at the back
        StrPushBackCstr(&s, " World", 6);
    
        // Check that the string was inserted correctly
    /// FAILURE : NULL
    ///
    #define StrPushBackZstr(str, zstr) StrPushBackCstr((str), (zstr), strlen((zstr)))
    
    ///
Last updated on