FIX: Concatenated Output to Binary File Causes Machine HaltLast reviewed: September 16, 1997Article ID: Q86741 |
5.10 | 5.10
MS-DOS | OS/2
kbprg kbfixlist kbbuglist kbcode
The information in this article applies to:
SYMPTOMSApplications repeatedly output concatenated strings to binary files may cause the machine to halt under MS-DOS or a Trap D protection violation under OS/2.
RESOLUTIONAssign the result of the string concatenation to a temporary variable to avoid the use of concatenation directly in WRITE statements to binary files. Or use commas to separate the output data rather than concatenation.
STATUSMicrosoft has confirmed this to be a problem in FORTRAN version 5.1. This problem was corrected in FORTRAN PowerStation, version 1.0.
MORE INFORMATIONThe following code can be used to demonstrate the problem.
Sample Code #1The following code reproduces the problem:
character*100 aline aline = 'a' open(1,file='test.dat',form='binary') k = 100 do i=1,10000 print*, i write(1) aline(:k)//'b' end do end Sample Code #2The following code will correct the problem:
character*100 aline character*101 bline aline = 'a' open(1,file='test.dat',form='binary') k = 100 do i=1,10000 print*, i bline = aline(:k)//'b' write(1) bline end do end Sample Code #3The following code will also correct the problem:
character*100 aline aline = 'a' open(1,file='test.dat',form='binary') k = 100 do i=1,10000 print*, i write(1) aline(:k),'b' end do end |
Additional reference words: 5.10 buglist5.10 fixlist1.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |