Iachar is a CHARACTER intrinsic function.
This function takes a character and will return the integer value corresponding to its location in ASCII character set.
iachar ( string )
Where string is a single character encapsulated in single quotes or a character variable containing a single character. ( this also means you can't have a character variable that has a bunch of spaces trailing a single character ). Note: The function iachar must output its results to an integer variable.
If you had a program that contained the following lines of code:
L = iachar('b') J = iachar('B') M = iachar('~')
The variables L, J, and M would have the following values respectively, 98,66, and 126. Notice that single quotes must be placed around the character. Also, be aware that the Fortran compiler may be case insensitive when it comes to variable names, but when you use this function lower and upper case letters have a different integer value associated with them. This is because upper and lower case letters hold different positions in the ASCII character set.
lecture twenty five examples
Written by Jason Wehr : email@example.com and Maintained by John Mahaffy : firstname.lastname@example.org