Display one or more values to the console
? | ?? [<exp list>]
<exp list> is a list of values to display and can be any combination of data types, including memo.
If you specify no argument and use the ? command, a carriage return/linefeed is sent to the console. If you use the ?? command without arguments, nothing happens.
? and ?? are console commands that display the results of one or more expressions, separated by a space, to the console. These commands are also command synonyms for the QOUT() and QQOUT() functions, respectively.
Although functionally similar, ? and ?? differ slightly. ? sends a carriage return/linefeed to the console before displaying the results of the expression list. ?? displays output at the current screen cursor or printhead position. This lets you use successive ?? commands to display output to the same line.
A ? or ?? command locates the cursor or printhead one position to the right of the last character displayed. If SET PRINTER is OFF, ROW() and COL() are updated to reflect the new cursor position. If SET PRINTER is ON, PROW() and PCOL() are updated with the new printhead position.
If output from a ? or ?? command reaches the edge of the screen as reported by MAXCOL(), it wraps to the next line. If the output reaches the bottom of the screen as reported by MAXROW(), the screen scrolls up one line.
You can echo output from the ? or ?? commands to the printer by specifying a SET PRINTER ON command before beginning output. You can echo output from both of these commands to a text file using SET ALTERNATE TO <xcFile> to create the file, and SET ALTERNATE ON to begin echoing to the file. Like other console commands, SET CONSOLE OFF suppresses the display to the screen without affecting output to the printer or text file.
To format any expression specified, use TRANSFORM() or a user-defined function. If you need to pad a variable length value for column alignment, use any of the PAD() functions to left-justify, right- justify, or center the value. See the examples below.
. This example prints a record from a database file using ? and ?? commands with PADR() to ensure column alignment: LOCAL nPage := 0, nLine := 99 USE Salesman INDEX Salesman NEW SET PRINTER ON SET CONSOLE OFF DO WHILE !EOF() IF nLine > 55 IF nPage != 0 EJECT ENDIF ? PADR("Page", LTRIM(STR(nPage++)), 72) ?? DTOC(DATE()) ? ? ? PADC("Sales Listing", 79) ? nLine := 5 ENDIF ? Name, Address, PADR(RTRIM(City) + "," ; + State, 20), ZipCode nLine++ SKIP ENDDO SET CONSOLE ON SET PRINTER OFF CLOSE Salesman
@…SAY, PAD(), QOUT(), SET ALTERNATE, SET CONSOLE, SET PRINTER