Microsoft KB Archive/68446

= WIDTH &quot;CONS: &quot; or &quot;SCRN:&quot; Uses Only 40 or 80 in Basic 7.00/7.10 =

Article ID: 68446

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 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 &quot;CONS:&quot; 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 &quot;SCRN:&quot; 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 &quot;CONS:&quot; or &quot;SCRN:&quot;. (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 &quot;scrn:&quot;, 11  ' Sets screen width to 11 characters. OPEN &quot;scrn:&quot; FOR OUTPUT AS #1               ' OK in 4.50, but PRINT #1, &quot;123456789012345678901234567890&quot;  ' WIDTH ignored in Basic CLOSE                                       ' 7.x in .EXE and QBX.EXE OPEN &quot;scrn:&quot; FOR OUTPUT AS #2 WIDTH #2, 11                                ' OK in 4.50, but WIDTH PRINT #2, &quot;123456789012345678901234567890&quot;  ' ignored in Basic 7.x CLOSE WIDTH &quot;cons:&quot;, 11 OPEN &quot;cons:&quot; FOR OUTPUT AS #3 PRINT #3, &quot;123456789012345678901234567890&quot; ' WIDTH ignored, 7.x, 4.50 CLOSE OPEN &quot;cons:&quot; FOR OUTPUT AS #4 WIDTH #4, 10 PRINT #4, &quot;123456789012345678901234567890&quot; ' WIDTH ignored, 7.x, 4.50 CLOSE

' Note that the problem doesn't occur with the &quot;LPT1:&quot; device: WIDTH &quot;lpt1:&quot;, 11  ' Sets printer width to 11 characters. OPEN &quot;lpt1:&quot; FOR OUTPUT AS #1 PRINT #1, &quot;123456789012345678901234567890&quot; ' 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 &quot;#&quot; 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, &quot;LPT1:&quot;). - The width assignment is deferred until the next OPEN statement affecting the device. - The assignment does not affect output for an already open file.

Additional query words: BasicCom SR# S901023-92 buglist7.00 buglist7.10 docerr

Keywords: KB68446

-

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

© Microsoft Corporation. All rights reserved.