Skip to content

IntFromOctStr

Description

Compatibility wrapper for IntTryFromOctStr(...).

Success

Returns Parsed integer value, or zero on failure.

Failure

Returns a zero-initialised Int on a non-octal character, an empty digit run, or an allocation failure. Use IntTryFromOctStr(...) when explicit failure propagation is required.

Usage example (Cross-references)

Usage examples (Cross-references)
        DefaultAllocator alloc = DefaultAllocatorInit();
    
        Int value = IntFromOctStr("0o7_55", ALLOCATOR_OF(&alloc));
        Str text  = IntToOctStr(&value);
    
    bool test_int_from_octal_null(void) {
        WriteFmt("Testing IntFromOctStr NULL handling\n");
    
        DefaultAllocator alloc = DefaultAllocatorInit();
        DefaultAllocator alloc = DefaultAllocatorInit();
    
        Int  parsed = IntFromOctStr((Zstr)NULL, ALLOCATOR_OF(&alloc));
        Int  value  = IntInit(ALLOCATOR_OF(&alloc));
        bool result = !IntTryFromOctStr(&value, (Zstr)NULL);
Last updated on