contents   index   previous   next



Fortran strings

 

Fortran stores characters as ANSI (single-byte) strings. The space allocated for a Fortran String is set during compile time, when you declare the string. For example the instruction:

 

character(len=20)::MyFString

 

tells the compiler to allocate a string with enough space to store 20 characters. If the string you put in MyFString is smaller than 20 characters, Fortran stores the string on the left side of the allocated space, and fills up the rest of the space to the right with blank characters (the ASCII code for a space character), as shown in Figure 1.1. Because of this, Fortran and C strings (strings created by the C language and used by many functions in the Windows operating system) are somewhat incompatible. C strings are null-terminated (the end of the string is indicated with a null character). f90VB handles Fortran strings in Fortran's native format.

 

OLE strings