Skip to content
StrPushBackZstr

StrPushBackZstr

StrPushBackZstr

Description

Push a null-terminated string to the back of string.

Parameters

Name Direction Description
str in,out Str to insert array chars into.
zstr in Null-terminated string to be appended.

Success

str

Failure

NULL

Usage example (Cross-references)

Usage examples (Cross-references)
                    char *zstr = generate_cstring(data, offset, size, 20);
                    if (zstr) {
                        StrPushBackZstr(str, zstr);
                        free(zstr);
                    }
                    char *zstr = generate_cstring(data, offset, size, 20);
                    if (zstr) {
                        StrPushBackZstr(str, zstr);
                        free(zstr);
                    }
                char c2  = low < 10 ? '0' + low : is_caps ? 'A' + (low - 10) : 'a' + (low - 10);
    
                StrPushBackZstr(o, "\\x");
                StrPushBack(o, c1);
                StrPushBack(o, c2);
                }
            } else {
                StrPushBackZstr(o, "\\x");
                u8   c     = *vs;
                u8   low   = c & 0xf;
                        StrPushFront(&hex, '0');
                    }
                    StrPushBackZstr(o, "0x");
                    StrMerge(o, &hex);
                    StrDeinit(&hex);
                        } else {
                            const char *digits = "0123456789abcdef";
                            StrPushBackZstr(o, "\\x");
                            StrPushBack(o, digits[(c >> 4) & 0xf]);
                            StrPushBack(o, digits[c & 0xf]);
                        StrPushFront(&hex, '0');
                    }
                    StrPushBackZstr(o, "0x");
                    StrMerge(o, &hex);
                    StrDeinit(&hex);
                        } else {
                            const char *digits = "0123456789abcdef";
                            StrPushBackZstr(o, "\\x");
                            StrPushBack(o, digits[(xs[i] >> 4) & 0xf]);
                            StrPushBack(o, digits[xs[i] & 0xf]);
            // Direct string append for NaN
            if (fmt_info->flags & FMT_FLAG_CAPS) {
                StrPushBackZstr(o, "NAN");
            } else {
                StrPushBackZstr(o, "nan");
                StrPushBackZstr(o, "NAN");
            } else {
                StrPushBackZstr(o, "nan");
            }
        } else if (isinf(*v)) {
    
            if (fmt_info->flags & FMT_FLAG_CAPS) {
                StrPushBackZstr(o, "INF");
            } else {
                StrPushBackZstr(o, "inf");
                StrPushBackZstr(o, "INF");
            } else {
                StrPushBackZstr(o, "inf");
            }
        } else {
            // Format as hexadecimal
            if (bv->length == 0) {
                StrPushBackZstr(o, "0x0");
            } else {
                // Convert to integer (up to 64 bits) and format as hex
            // Format as octal
            if (bv->length == 0) {
                StrPushBackZstr(o, "0o0");
            } else {
                u64          value  = BitVecToInteger(bv);
                }
            } else {
                StrPushBackZstr(&result, "0.");
    
                for (i64 i = 0; i < -split; i++) {
        // Build command line
        Str cmdline = StrInit();
        StrPushBackZstr(&cmdline, filepath);
        for (char **arg = argv + 1; *arg; ++arg) {
            StrPushBack(&cmdline, ' ');
        for (char **arg = argv + 1; *arg; ++arg) {
            StrPushBack(&cmdline, ' ');
            StrPushBackZstr(&cmdline, *arg);
        }
    // Test StrPushBackZstr function
    bool test_str_push_back_zstr(void) {
        WriteFmt("Testing StrPushBackZstr\n");
    
        Str s = StrInitFromZstr("Hello");
    
        // Push a string at the back
        StrPushBackZstr(&s, " World");
    
        // Check that the string was inserted correctly
    
        // Add some data
        StrPushBackZstr(&s, "Hello");
    
        // Original capacity should be at least 100
        StrInitStack(stack_str, 20, {
            // Inside the scope where the stack string is valid
            StrPushBackZstr(&stack_str, "Hello, Stack!");
    
            // Validate the string
Last updated on