BUG: Error w/ CHAR() in WRITE of Unformatted or Binary OutputLast reviewed: February 29, 1996Article ID: Q147756 |
The information in this article applies to:
SYMPTOMSWriting unformatted character output to a file with a CHAR expression causes an application error similar to the following: Under Windows NT version 3.51:
Application Error - The instruction at 0x0040a9ba referenced memory at 0x00000041. The memory could not be readUnder Windows 95:
This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor.-or- Writing binary character output to a file with a CHAR expression causes an application error similar to the following: Under Windows NT version 3.51:
Application Error - The instruction at 0x0040a773 referenced memory at 0x00000041. The memory could not be read.Under Windows 95:
This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor. RESOLUTIONPerform intermediate calculations in a temporary variable. Then use it in the CHAR() expression.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONThe following code demonstrates the problem writing unformatted output:
Sample CodeC Compile options needed: none
integer len len = 66 open(1,file='t.out',form='unformatted')C The following line causes an Access violation write(1) char(len-1) ! Comment this line for workaroundC To workaround the problem perform intermediate calculations C in a temporary variable and use it in the char() expression.
C i = len - 1 ! Uncomment this line for workaround C write(1) char(i) ! Uncomment this line for workaround close(1) endThe following code demonstrates the problem writing binary output:
Sample CodeC Compile options needed: none
integer len len = 66 open(1,file='t.out',form='binary')C The following line causes an Access violation write(1) char(len-1) ! Comment this line for workaroundC To workaround the problem perform intermediate calculations C in a temporary variable and use it in the char() expression.
C i = len - 1 ! Uncomment this line for workaround C write(1) char(i) ! Uncomment this line for workaround close(1) end |
Additional reference words: 4.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |