String of octal number converted to integer of kind 8
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=8), | intent(out) | :: | r | |||
character(len=*) | :: | octstr |
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