Skip to content

IntToOctStr

Description

Convert an integer to an octal string.

Parameters

Name Direction Description
value in Integer to convert.

Success

Returns a Str holding the base-8 textual form of value, bound to value’s allocator. value is not modified.

Failure

Returns an empty Str bound to value’s allocator when the underlying IntToStrRadix fails (intermediate allocation failure). The caller cannot distinguish that from a true empty result; use IntTryToStrRadix directly when failure detection is required.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    Str IntToOctStr(const Int *value) {
        return IntToStrRadix(value, 8, false);
    }
    
        Int value = IntFromOctStr("0o7_55", ALLOCATOR_OF(&alloc));
        Str text  = IntToOctStr(&value);
    
        bool result = IntToU64(&value) == 493;
        z = "755";
        StrReadFmt(z, "{o}", oct);
        oct_text = IntToOctStr(&oct);
        success  = success && (ZstrCompare(StrBegin(&oct_text), "755") == 0);
Last updated on