ID: Q147756
4.00 | 4.00
WINDOWS | WINDOWS NT
kbprg kbbuglist
The information in this article applies to:
Writing 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 read
Under 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.
Perform intermediate calculations in a temporary variable. Then use it in the CHAR() expression.
Microsoft 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.
The following code demonstrates the problem writing unformatted output:
C 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 workaround
C 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
The following code demonstrates the problem writing binary output:
C 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 workaround
C 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
KBCategory: kbprg kbbuglist
KBSubcategory: FORTLngIss
Keywords : kbFortranPS kbLangFortran kbbuglist
Version : 4.00 | 4.00
Platform : NT WINDOWS
Last Reviewed: March 3, 1996