Functions and Directives

Function QOut() | QQOut() Foundation

Displays a list of expressions to the active output device.

QOut(  [<Expression,...>] ) --> NIL
QQOut( [<Expression,...>] ) --> NIL
<Expression,...> is a comma-separated list of expressions. Each expression can contain any data type. The value of each expression is output to the active output device (normally the screen), starting at the current cursor position. Prior the first expression (or if <Expression,...> is not included) the function QOut() also outputs the control characters carriage-return and line-feed (Chr(13)+Chr(10)). This positions the cursor at the beginning of the next output line prior to output. For each comma in <Expression,...> a blank space is output.

QOut() and QQOut() always return NIL.


QOut() and QQOut() are output functions. The commands ? and ?? are translated by the preprocessor to QOut() and QQOut(). The difference between these two functions is that QOut() outputs the control characters carriage return/line feed (Chr(13)+Chr(10)) before output of the expression list <Expression,...>. This causes output to always begin at the start of a line. QQOut(), on the other hand, begins output at the current cursor position.

Both functions change the cursor position of the active output device. When the output occurs on the screen the row and column position of the screen cursor (functions Row() and Col()) are changed. When the output is to the printer (for example, after SET PRINTER ON) the counters for the print head position are updated (functions PRow() and PCol()). If <Expression,...> contains more than one expression, the functions QOut() and QQOut() both insert a blank space between the individual output values.

Unlike the commands ? and ??, the functions QOut() and QQOut() can be used inside code blocks. This allows screen output to occur during iteration functions like AEval() and DbEval().

Simple output with QOut() and QQOut()

// Output of different data types on the screen 

   SetPos( 10, 10 )                  // positions cursor 

   QQOut( .T., 10, "String")         // output begins at 10,10 
   QOut( Date(), Time(), Seconds() ) // output begins at 11, 0 

Output with AEval() and QOut()
// Display of the field structure of a DBF file 
// using the iteration function AEval() 

FUNCTION ListStruct() 
   LOCAL aArray := DbStruct()       // creates field structure array 

   RETURN AEval( aArray, ; 
                {|aElem| QOut(aElem[1], ; // output contents of 
                              aElem[2], ; // each subarray 
                              aElem[3], ; 
                              aElem[4]) } ) 

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.