ctoi_I2P Function

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

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

Arguments

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

Return Value integer(kind=I2P)


Called by

proc~~ctoi_i2p~~CalledByGraph proc~ctoi_i2p ctoi_I2P interface~cton cton interface~cton->proc~ctoi_i2p

Contents

Source Code


Source Code

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

  !---------------------------------------------------------------------------------------------------------------------------------
  implicit none
  character(*), intent(IN):: str   ! String containing input number.
  integer(I2P), intent(IN):: knd   ! Number kind.
  integer(I2P)::             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,'//FI2P//')') 'Kind parameter ',knd
    write(6,'(A)')            'Function used "ctoi_I2P"'
  endif
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction ctoi_I2P