Difference between revisions of "TYPE"

From Recital Documentation Wiki
Jump to: navigation, search
Line 29: Line 29:
 
set printer to \\spooler
 
set printer to \\spooler
 
file = dir("*.prg", .T.)
 
file = dir("*.prg", .T.)
do while .not. empty(file)
+
do while not empty(file)
 
     type file &file to print
 
     type file &file to print
 
     file = dir("*.prg", .F.)
 
     file = dir("*.prg", .F.)
Line 41: Line 41:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Input Output]]
 +
[[Category:Input Output Commands]]

Revision as of 11:01, 24 June 2009

Class

Input/Output


Purpose

Display a text file on the screen or printer


Syntax

TYPE [FILE] <.txt filename> | (<expC>) [TO PRINT]


See Also

ALIAS, DB_PRINT, PRINT, SET PAGELENGTH


Description

The TYPE command displays the specified text file on the screen. If no filename is specified, '.txt' is used. The file name can be substituted with an <expC>, enclosed in round brackets, which returns a valid filename.

FILE

If the optional FILE keyword is specified, then the text file will be displayed in pages, with line numbers, and the name of the file will be displayed as a heading above each page. The length of each page may be specified with the SET PAGELENGTH TO command. This feature is particularly useful for producing program listings.

TO PRINT

If the optional TO PRINT clause is specified, then the file will be output to the printer. The TO PRINT option will default to a local printer unless the command SET PRINTER TO \\SPOOLER is issued. SET PRINTER TO \\SPOOLER causes the file to be spooled to the system printer defined by the environment variable DB_PRINT.


Example

set printer to \\spooler
file = dir("*.prg", .T.)
do while not empty(file)
    type file &file to print
    file = dir("*.prg", .F.)
enddo
set printer to


Products

Recital Database Server, Recital Mirage Server, Recital Terminal Developer