www.delorie.com/gnu/docs/gcc/g77_114.html   search  
 
Buy the book!


Using and Porting GNU Fortran

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.11.9.39 Char Intrinsic

 
Char(I)

Char: CHARACTER*1 function.

I: INTEGER; scalar; INTENT(IN).

Intrinsic groups: (standard FORTRAN 77).

Description:

Returns the character corresponding to the code specified by I, using the system's native character set.

Because the system's native character set is used, the correspondence between character and their codes is not necessarily the same between GNU Fortran implementations.

Note that no intrinsic exists to convert a numerical value to a printable character string. For example, there is no intrinsic that, given an INTEGER or REAL argument with the value `154', returns the CHARACTER result `'154''.

Instead, you can use internal-file I/O to do this kind of conversion. For example:

 
INTEGER VALUE
CHARACTER*10 STRING
VALUE = 154
WRITE (STRING, '(I10)'), VALUE
PRINT *, STRING
END

The above program, when run, prints:

 
        154

See section 8.11.9.137 IChar Intrinsic, for the inverse of the CHAR function.

See section 8.11.9.4 AChar Intrinsic, for the function corresponding to the ASCII character set.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003