ctoi_I8P Function

private function ctoi_I8P(str, knd) result(n)

The function ctoi_I8P converts string to integer. This function achieves casting of string to integer.

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: str
integer(kind=I8P), intent(in) :: knd

Return Value integer(kind=I8P)


Called by

proc~~ctoi_i8p~~CalledByGraph proc~ctoi_i8p ctoi_I8P interface~cton cton interface~cton->proc~ctoi_i8p

Contents

Source Code


Source Code

  function ctoi_I8P(str,knd) result(n)
  !---------------------------------------------------------------------------------------------------------------------------------
  !!The function ctoi\_I8P converts string to integer. This function achieves casting of string to integer.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  implicit none
  character(*), intent(IN):: str   ! String containing input number.
  integer(I8P), intent(IN):: knd   ! Number kind.
  integer(I8P)::             n     ! Number returned.
  integer(I4P)::             E_IO  ! Input/Output debug flag.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  read(str,*,iostat=E_IO) n ! Casting of str to n.
  if (E_IO/=0) then
    write(6,'(A)')            'Conversion of string "'//str//'" to integer failed'
    write(6,'(A,'//FI8P//')') 'Kind parameter ',knd
    write(6,'(A)')            'Function used "ctoi_I8P"'
  endif
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction ctoi_I8P