FIX: Bad Output with Element of Structure in CHAR FunctionLast reviewed: September 11, 1997Article ID: Q69002 |
5.00 5.10 | 5.00 5.10
MS-DOS | OS/2
kbtool kbfixlist kbbuglist
The information in this article applies to:
SYMPTOMSIn FORTRAN 5.0 and 5.1, a program using the CHAR intrinsic function on a structure element within a WRITE or PRINT statement can produce erroneous output when executed under MS-DOS, or result in a protection violation when executed under OS/2.
RESOLUTIONTo avoid these problems, remove the intrinsic function from the WRITE or PRINT statement by assigning the result of the CHAR intrinsic function to a temporary variable, and then use this variable in the output statement.
STATUSMicrosoft has confirmed this to be a problem in FORTRAN versions 5.0 and 5.1. This problem was corrected in FORTRAN PowerStation.
MORE INFORMATIONThe following example reproduces the problem:
structure /a/ integer*2 i end structure record /a/ name name.i=97 ! ASCII lowercase a write(*,*) char(name.i) end One possible solution is to assign the result of the CHAR intrinsic function to a temporary variable as illustrated by the following example:
structure /a/ integer*2 i end structure character c record /a/ name name.i=97 ! ASCII lowercase a c=char(name.i) write(*,*) c end |
Additional reference words: 5.00 5.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |