xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

? | ??

Displays values of expressions to the console window.

Syntax

? [<expression,...>]
?? [<expression,...>]

Arguments

<expression,...>
<expression> is an optional, comma separated list of expressions whose values are output. When no expression is specified, the ? command outputs a new line while ?? outputs nothing.

Description

The ? and ?? commands are text mode console commands that display the result of a comma separated list of expressions to the currently selected output device. This can be the screen, or console window or the printer. The functional equivalent of both commands are the QOut() and QQOut() functions.

The difference between ? and ?? is that the ? command first outputs a carriage-return/line-feed pair so that the output of <expression,...> always begins at a new line, while ?? outputs the values of <expression,...> at the current cursor or printhead position.

The ? or ?? command first locates the current cursor or printhead position and shifts it one to the right. Row() and Col() are updated with the new cursor position if SET PRINTER is OFF, otherwise they are updated with the new printhead position.

Should the output of ? or ?? reach the right border of the screen (defined by MaxCol()), it will wrap to the next line. Should the output of ? or ?? reach the bottom border of the screen (defined by MaxRow()), the screen will scroll up one line.

It is possible to output the expression(s) to the printer by using the SET PRINTER ON before using the ? or ?? command. It is also possible to output to a text file using the SET ALTERNATE TO command, followed by the SET ALTERNATE ON command. The SET CONSOLE OFF command will prevent display on the screen without interrupting the output to the printer or text file.

When the expression(s) need formatting, use the Transform() function or any user-defined function. For padding, use any of the Pad() functions to center, left align or right align the expression(s).

Info

See also:@...SAY, PadC() | PadL() | PadR(), QOut() | QQOut(), SET ALTERNATE, SET CONSOLE, SET DEVICE, SET PRINTER, Transform()
Category: Console commands
Source:rtl\console.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// This example displays a list of expressions:

   PROCEDURE Main
      LOCAL var1 := 1, var2 := Date(), var3 := .T.

      ? "This line will be displayed on the console."
      ? "This line will be displayed beneath the previous line."
      ?? "No carriage return / linefeed for this expression!"
      ? var1, var2, var3, "These were variables"
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe