OUTPUT

Specifies destination for text output. Output is either to the screen, or to a file.

Syntax:

OUTPUT SCREEN 
OUTPUT filename
OUTPUT filename, APPEND
 

Discussion:

If OUTPUT SCREEN is specified alone, then all subsequently executed PRINT commands will be directed to the screen. If a valid filename is provided, then subsequent PRINT commands will output to the filename specified. If a filename with no path is provided, output will be directed to the <data>\Macros folder.

To close the file created earlier, use OUTPUT SCREEN which will direct subsequent PRINT outputs to the screen. SHOWFILE will close the file and send it to the text viewer program for screen display. PRINTFILE will close the file and print it on the currently defined printer.

Note that when sending PRINT commands to an output file, the file will be in Unicode format. To convert the file to ANSI, first close the file (for example using OUTPUT SCREEN) and then use the CONVERTFILEFORMAT keyword.

If the keyword APPEND follows the file name, then subsequent output will be appended to the file. Otherwise, the contents of the file will be overwritten.

Example:

OUTPUT "x.txt"
PRINT "This will not appear on the screen, but in the file x.txt." 
OUTPUT SCREEN
PRINT "This will appear on the screen." 
OUTPUT "x.txt", APPEND
PRINT "This will appear after the first line in the file x.txt."
 

Related Keywords:

CLOSE, OPEN, SHOWFILE, PRINTFILE

Next: