ERDEV$ Returns Incorrect Value Under MS-DOS 5.0 (90396)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft Basic Professional Development System for MS-DOS 7.0
  • Microsoft Basic Professional Development System for MS-DOS 7.1
  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft MS-DOS operating system 5.0

This article was previously published under Q90396

SYMPTOMS

The ERDEV$ function in Basic will return an incorrect value under MS-DOS version 5.0 for errors on the parallel ports LPT1 and LPT2. Instead of returning "LPT1:" when an error occurs on LPT1, ERDEV$ returns "M:", and with LPT2: it returns "T:".

STATUS

Microsoft has confirmed this to be a bug in the Standard and Professional Editions of Microsoft Visual Basic version 1.0 for MS-DOS; in Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 (buglist7.00 buglist7.10) for MS-DOS; in Microsoft QuickBasic version 4.5 (buglist4.50) for MS-DOS, while running Microsoft MS-DOS version 5.0. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

This problem does not occur under earlier versions of MS-DOS.

MORE INFORMATION

Steps to Reproduce Problem

  1. From the File menu, choose New Project.
  2. Copy the following code example into the Code window:
    ON ERROR GOTO handler
    LPRINT "Hello"
    END
    
    handler:
       PRINT ERDEV$
       END
    						
  3. Press the F5 to key run the program.

WORKAROUND

The only way to work around this problem is to explicitly keep track of what device your program is currently performing device I/O with, and use that as an indication of where the error occurred rather than rely on the ERDEV$ function.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB90396