Microsoft KB Archive/40632

= If PRINT Fails on Non-Standard System, PRINT#n to &quot;CONS: &quot; =

Article ID: 40632

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q40632



SUMMARY
The PRINT and WRITE statements write directly to video memory; they do not write to the screen through function calls to MS-DOS or the ROM BIOS. This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50, Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2, and Microsoft Basic PDS Version 7.00 for MS-DOS and MS OS/2.

By circumventing MS-DOS and the ROM BIOS, the PRINT and WRITE statements may not work correctly with certain non-standard or unsupported operating-system configurations (such as PC-MOS, Multi-DOS, or multitasking packages added to MS-DOS).

To be more compatible with non-standard systems, you can send output to a logical device name that routes the characters through an MS-DOS character device driver.

For example, output through the &quot;CONS:&quot; (CONSole) or &quot;CON&quot; device name forces all output through the MS-DOS console device driver. The MS-DOS console device driver makes ROM BIOS calls to perform the output.

You can OPEN &quot;CONS:&quot; FOR OUTPUT AS #n and send output with the PRINT#n or WRITE#n statement.

Similarly, if you have trouble printing with LPRINT to a network printer, OPEN &quot;LPT1:&quot; FOR OUTPUT AS #n and send output with the PRINT#n or WRITE#n statement.



MORE INFORMATION
Some computer manufacturers provide an ANSI.SYS device driver on their DOS disk. Limited graphics control may be performed through ANSI control codes. For more information about ANSI codes, query on the following words:

PRINT# MS-DOS &quot;CON&quot; Device ANSI Escape Codes

The following device names supported by the OPEN statement are discussed on Pages 293 and 294 of the &quot;Microsoft QuickBasic Version 4.0: Basic Language Reference&quot; manual for Versions 4.00 and 4.00b:

&quot;CONS:&quot;

&quot;KYBD:&quot;

&quot;SCRN:&quot;

&quot;COM1:&quot;, &quot;COM2:&quot;

&quot;LPT1:&quot;, &quot;LPT2:&quot;

The following is a code example: CLS OPEN &quot;CONS:&quot; FOR OUTPUT AS #1 PRINT #1, &quot;Howdy pahd-nuh...&quot; CLOSE #1 END

Additional query words: QuickBas BasicCom

Keywords: KB40632

-

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

© Microsoft Corporation. All rights reserved.