The Aw and A descriptors are used for CHARACTER input. The general forms are:
The meaning of r and w are:
1 1 2 ....5....0....5....0 ABCDEFGHIJKLMNOPQRST
Variable a takes the first four positions (i.e., A, B, C and D). Since the length of a is five, which is larger than w=4, a space is appended to the right. Therefore, a receives "ABCD ". Variable b takes the next five positions (i.e., E, F, G, H and I). Since w=5 which is equal to the length of b, b receives all five characters "EFGHI". Variable c takes the next seven positions (i.e., J, K, L, M, N, O and P). Since w=7 is larger than the length of the variable, only the right-most five positions will be taken. Thus, variable c receives "LMNOP". Finally, variable d uses A. Since the length of variable d is 3, this A edit descriptor is equivalent to A3 and hence d takes the next three positions (i.e., Q, R and S). As a result, variable d receives "QRS".CHARACTER(LEN=5) :: a, b, c CHARACTER(LEN=3) :: d READ(*,"(A4, A5, A7, A") a, b, c, d
Variable a takes the first five positions (i.e., A, B, C, D and E). Since the length of a is five, a receives "ABCDE". Variable b takes the next five positions (i.e., F, G, H, I and J). Since the length of b is 3, only the right-most three positions are used and consequently b receives "HIJ". Variable c takes the next five positions (i.e., K, L, M, N and O). Since the length of c is seven, which is more than the number of positions, two spaces are appended and c receives "KLMNO ". The last five positions are for variable d. Since the length of d is four, only the right-most four positions are taken and variable d receives "QRST".CHARACTER(LEN=5) :: a, b*3, c*7, d*4 INTEGER :: a, b, c, d READ(*,"(4A5)") a, b, c, d