FIX: Bad Data Files When Backslash Edit Sent to ScreenLast reviewed: September 16, 1997Article ID: Q75763 |
5.10 | 5.10
MS-DOS | OS/2
kbprg kbfixlist kbbuglist kbcode
The information in this article applies to:
SYMPTOMSPrograms compiled with FORTRAN version 5.1 running under MS-DOS, OS/2, or QuickWindows, may produce files in which records are not separated by carriage return-linefeeds. All data appears to be on the same line.
CAUSEUsing the backslash edit descriptor to suppress the carriage return- linefeed sent after output to the screen can corrupt list-directed file I/O. Specifically, carriage return-linefeeds are no longer be sent to data files if output is sent to them list-directed. This means that no delimiters will exist between records within the data files, and subsequently, they will not be read correctly. The sample code in the MORE INFORMATION section illustrates this problem.
RESOLUTIONTo preserve the carriage return-linefeed characters written to files when using the backslash edit descriptor, a backslash must be sent to a file or the screen a second time.
STATUSMicrosoft has confirmed this to be a problem in Microsoft FORTRAN version 5.1 for MS-DOS and OS/2. This problem was corrected in FORTRAN PowerStation, version 1.0.
MORE INFORMATIONThe following code reproduces the problem:
Sample Code
open(2,file='test.dat') write(*,'(1x,a,\)') 'write to screen' write(2,*) 'first record' write(2,*) 'second record' endThe following data file is the output of the above program:
first record second recordThe output file should contain carriage return-linefeeds between records, as illustrated below:
first record second recordThe following code sends the backslash to the NUL bin, so no extra file is created in the directory. This code preserves the carriage-return linefeed characters within data files.
open(2,file='test.dat') open(3,file='nul') ! Open a file to write backslash ! to, NUL will not create a file. write(*,'(1x,a,\)') 'write to screen' write(3,'(a\)') ! Write backslash a second time. write(2,*) 'first record' write(2,*) 'second record' end |
Additional reference words: 5.10 buglist5.10 fixlist1.00 invalid output
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |