WIDTH "CONS: " or "SCRN:" Uses Only 40 or 80 in Basic 7.00/7.10 (68446)



The information in this article applies to:

  • Microsoft QuickBASIC 4.5
  • Microsoft Basic Professional Development System for MS-DOS 7.0
  • Microsoft Basic Professional Development System for MS-DOS 7.1

This article was previously published under Q68446

SYMPTOMS

In Basic PDS 7.00 and 7.10, the WIDTH for the screen device is restricted to 40 or 80 characters across all the different WIDTH syntaxes.

The WIDTH statement fails to set widths other than 40 or 80 for the "CONS:" device name in QuickBasic 4.50 (buglist4.50) and Basic PDS 7.00 and 7.10. The WIDTH statement also fails to set widths other than 40 or 80 for the "SCRN:" device name for Basic PDS 7.00 and 7.10, but succeeds in QuickBasic 4.50. (The problem occurs both in the environment and in a compiled .EXE program.) The documentation does not explicitly say what is expected for the WIDTH dev$,wid% syntax.

STATUS

This may be a design restriction. Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

This information applies to QuickBasic version 4.50 and to Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 for MS-DOS.

MORE INFORMATION

Basic PDS 7.00 and 7.10 only lets you use WIDTH of 40 or 80 for the WIDTH dev$,wid% syntax when dev$ is the screen device name "CONS:" or "SCRN:". (This behavior actually matches the documented restriction for the separate WIDTH wid%,height% syntax for screen output.)

The following code example demonstrates this behavior:

Code Example

CLS
WIDTH "scrn:", 11   ' Sets screen width to 11 characters.
OPEN "scrn:" FOR OUTPUT AS #1                ' OK in 4.50, but
PRINT #1, "123456789012345678901234567890"   ' WIDTH ignored in Basic
CLOSE                                        ' 7.x in .EXE and QBX.EXE
OPEN "scrn:" FOR OUTPUT AS #2
WIDTH #2, 11                                 ' OK in 4.50, but WIDTH
PRINT #2, "123456789012345678901234567890"   ' ignored in Basic 7.x
CLOSE
WIDTH "cons:", 11
OPEN "cons:" FOR OUTPUT AS #3
PRINT #3, "123456789012345678901234567890"  ' WIDTH ignored, 7.x, 4.50
CLOSE
OPEN "cons:" FOR OUTPUT AS #4
WIDTH #4, 10
PRINT #4, "123456789012345678901234567890"  ' WIDTH ignored, 7.x, 4.50
CLOSE

' Note that the problem doesn't occur with the "LPT1:" device:
WIDTH "lpt1:", 11   ' Sets printer width to 11 characters.
OPEN "lpt1:" FOR OUTPUT AS #1
PRINT #1, "123456789012345678901234567890"  ' Works find in all versions.
CLOSE
				
Reference:

The following partial description of the WIDTH statement is taken from the QBX.EXE online help:
   WIDTH {#filenumber% | device$}, width%

WIDTH {#filenumber% | device$}, width%
  The WIDTH #filenumber%, width% form:
    - Sets the line width of an output device already opened as a file
      (for example, LPT1: or CONS:).
    - The argument filenumber% is the number associated with the
      file in the OPEN statement.
    - The "#" character in front of filenumber% is not optional.
    - The width assignment takes place immediately.
  The WIDTH device$, width% form:
    - Sets to width% the line with of device$ (a device filename).
      The device should be a string expression (for example, "LPT1:").
    - The width assignment is deferred until the next OPEN statement
      affecting the device.
    - The assignment does not affect output for an already open file.
				

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