Microsoft KB Archive/75763

= FIX: Bad Data Files When Backslash Edit Sent to Screen =

Article ID: 75763

Article Last Modified on 10/23/2003

-

APPLIES TO


 * Microsoft FORTRAN Compiler 5.1
 * Microsoft FORTRAN Compiler 5.1

-



This article was previously published under Q75763



SYMPTOMS
Programs 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.



CAUSE
Using 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.



RESOLUTION
To 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.



STATUS
Microsoft 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 INFORMATION
The 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' end The following data file is the output of the above program:

first record second record

The output file should contain carriage return-linefeeds between records, as illustrated below:

first record

second record

The 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 query words: 5.10 buglist5.10 fixlist1.00 invalid output

Keywords: kbfix KB75763

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.