ctoi_I1P Function

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

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

Arguments

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

Return Value integer(kind=I1P)


Called by

proc~~ctoi_i1p~~CalledByGraph proc~ctoi_i1p ctoi_I1P interface~cton cton interface~cton->proc~ctoi_i1p

Contents

Source Code


Source Code

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

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