PRB: BACKSPACE Works Improperly At End-of-file
PSS ID Number: Q10711
Article last modified on 02-09-1993

3.20

MS-DOS


----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft FORTRAN for MS-DOS, version 3.2
----------------------------------------------------------------------

Summary:

SYMPTOMS
   The BACKSPACE function does not work properly when the application
   reads to the end-of-file marker.

CAUSE
   The BACKSPACE function in the default library does not work
   correctly.

RESOLUTION
   To work around this problem, link the application with the
   DOS2FOR.LIB library.

STATUS
   Microsoft has confirmed this to be a problem in FORTRAN version 3.2
   for MS-DOS. This problem was corrected in FORTRAN version 3.3 for
   MS-DOS.

More Information:

The following code example demonstrates this problem.

C Compile options needed: None

      PROGRAM TEST
      INTEGER FH
      CHARACTER*70 LINE

      FH = 6
      OPEN (FH, FILE = ' ', STATUS = 'OLD')
100   CONTINUE
      READ (FH, 110, END = 200) LINE
110   FORMAT (A)
      WRITE (*, *) LINE
      GO TO 100
200   CONTINUE
      IF (EOF(FH)) WRITE (*, *) 'UNIT IS AT EOF'
      BACKSPACE FH
      WRITE (FH, 900) '*****THIS IS NEW INFO****'
900   FORMAT (A)
      WRITE (FH, 900) 'AND SO IS THIS...!'
      END

Additional reference words: 3.20

=============================================================================

Copyright Microsoft Corporation 1993.
