CVTSI

Converts a character string containing an integer number into the corresponding integer form.

Required Arguments

STRING — Character string containing an integer number. (Input)

NUMBER — The integer equivalent of STRING. (Output)

FORTRAN 90 Interface

Generic: CALL CVTSI (STRING, NUMBER)

Specific: The specific interface name is CVTSI.

FORTRAN 77 Interface

Single: CALL CVTSI (STRING, NUMBER)

Description

Routine CVTSI converts a character string containing an integer to an INTEGER variable. Leading and trailing blanks in the string are ignored. If the string contains something other than an integer, a terminal error is issued. If the string contains an integer larger than can be represented by an INTEGER variable as determined from routine IMACH (see the Reference Material), a terminal error is issued.

Example

The string “12345” is converted to an INTEGER variable.

 

USE CVTSI_INT

USE UMACH_INT

 

IMPLICIT NONE

INTEGER NOUT, NUMBER

CHARACTER STRING*10

!

DATA STRING/'12345'/

!

CALL CVTSI (STRING, NUMBER)

!

CALL UMACH (2, NOUT)

WRITE (NOUT,*) 'NUMBER = ', NUMBER

END

Output

 

NUMBER = 12345