Re: Type casting of integer to character in fortran




<munishwar.ahuja@xxxxxx> wrote in message
news:1114764604.602378.86180@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi
>
> How to typecast an integer to fortran
>
> e.g.
>
> IMPLICIT NONE
> INTEGER :: ID
> CHARACTER*30 :: AA
> ID=2
> AA='output_'//CHAR(ID)//'.dat'
> PRINT *, AA
> END
>
> This outputs equivalent ASCII Character in place of 2.
>
> Whats the way to typecast integer to character?
> So that I get output_2.dat as an output.
>
> Munish
>

AA = 'output_'//CHAR(ID+ICHAR('0'))//'.dat'


.



Relevant Pages

  • Type casting of integer to character in fortran
    ... IMPLICIT NONE ... This outputs equivalent ASCII Character in place of 2. ... Whats the way to typecast integer to character? ...
    (comp.lang.fortran)
  • Re: Type casting of integer to character in fortran
    ... >>IMPLICIT NONE ... >>This outputs equivalent ASCII Character in place of 2. ... >>Whats the way to typecast integer to character? ... > representation of 2 as an integer to the ASCII representation of the ...
    (comp.lang.fortran)
  • Implicit vs Explicit typecast/conversion operator ?
    ... Implicit means the conversion is done automatically without the ... programmer/user having to type a typecast. ... Explicit means the conversion has to be done by the programmer/user by ...
    (alt.comp.lang.borland-delphi)