oct_to_int8 Subroutine

public subroutine oct_to_int8(r, octstr)

String of octal number converted to integer of kind 8

Arguments

Type IntentOptional AttributesName
integer(kind=8), intent(out) :: r
character(len=*) :: octstr

Called by

proc~~oct_to_int8~~CalledByGraph proc~oct_to_int8 oct_to_int8 interface~oct2int oct2int interface~oct2int->proc~oct_to_int8 proc~int4_from_string int4_from_string proc~int4_from_string->interface~oct2int proc~int8_from_string int8_from_string proc~int8_from_string->interface~oct2int interface~assignment(=) assignment(=) interface~assignment(=)->proc~int4_from_string interface~assignment(=)->proc~int8_from_string

Contents

Source Code


Source Code

        subroutine oct_to_int8(r, octstr)
          !< String of octal number converted to integer of kind 8
            implicit none
            character(len=*) :: octstr
            integer(kind=8), intent(out) :: r
            integer :: current_digit
            integer :: i
            i = len(octstr)
            r = 0
            do while (i > 0)
                read (octstr(i:i), *) current_digit
                r = r + ((8 ** (len(octstr) - i)) * current_digit)
                i = i - 1
            end do
        end subroutine oct_to_int8