FIX: Bad Data Files When Backslash Edit Sent to Screen

Last reviewed: September 16, 1997
Article ID: Q75763
5.10 | 5.10 MS-DOS | OS/2 kbprg kbfixlist kbbuglist kbcode

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, version 5.1
  • Microsoft FORTRAN for OS/2, version 5.1

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 reference words: 5.10 buglist5.10 fixlist1.00 invalid output
KBCategory: kbprg kbfixlist kbbuglist kbcode
KBSubCategory: FORTLngIss
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.