QBasic/Advanced Text Output

< QBasic

Cursor manipulationEdit

As you try to write your text editor, you may realize that you will need to place the cursor in a given location on the screen. This is performed using the LOCATE statement.

Printing any character in the bottom-right corner of the screen will cause the display to scroll.


To change the current printing color, use the COLOR statement.

  COLOR 7,0  'Uses the default white on black.
  COLOR 15,0 'Bright white on black.
  COLOR 0,1  'Black on blue
  Color 14,0 'Bright yellow.

This can be used for title or status bars at the bottom.

Formatted printingEdit

The PRINT USING statement allows you to output strings or numbers in a specified format. With this statement, you can write numbers out to specified decimal places or perform advanced output.

The most common format specifiers would be # and ., which reserve space for digits and decimal points respectively. You may also use the underscore to ensure that a given character is printed literally.

Note - PRINT USING is unable to add 'leading zeros' to a number (if you specify eg 3 digits (###) a two digit number will be output with leading spaces).