[About The Guide]
Echo console output to a text file
SET ALTERNATE TO [<xcFile> [ADDITIVE]]
SET ALTERNATE on | OFF | <xlToggle>
TO <xcFile> opens a standard ASCII text file for output with a
default extension of .txt. The file name may optionally include an
extension, drive letter, and/or path. You may specify <xcFile> either
as a literal file name or as a character expression enclosed in
parentheses. Note that if a file with the same name exists, it is
ADDITIVE causes the specified alternate file to be appended instead
of being overwritten. If not specified, the specified alternate file is
truncated before new information is written to it.
ON causes console output to be written to the open text file.
OFF discontinues writing console output to the text file without
closing the file.
<xlToggle> is a logical expression that must be enclosed in
parentheses. A value of true (.T.) is the same as ON, and a value of
false (.F.) is the same as OFF.
SET ALTERNATE is a console command that lets you write the output of
console commands to a text file. Commands such as LIST, REPORT FORM,
LABEL FORM, and ? that display to the screen without reference to row
and column position are console commands. Most of these commands have a
TO FILE clause that performs the same function as SET ALTERNATE. Full-
screen commands such as @...SAY cannot be echoed to a disk file using
SET ALTERNATE. Instead you can use SET PRINTER TO <xcFile> with SET
DEVICE TO PRINTER to accomplish this.
SET ALTERNATE has two basic forms. The TO <xcFile> form creates a DOS
text file with a default extension of .txt and overwrites any other file
with the same name. Alternate files are not related to work areas with
only one file open at a time. To close an alternate file, use CLOSE
ALTERNATE, CLOSE ALL, or SET ALTERNATE TO with no argument.
The on|OFF form controls the writing of console output to the current
alternate file. SET ALTERNATE ON begins the echoing of output to the
alternate file. SET ALTERNATE OFF suppresses output to the alternate
file but does not close it.
. This example creates an alternate file and writes the results
of the ? command to the file for each record in the Customer database
SET ALTERNATE TO Listfile
SET ALTERNATE ON
USE Customer NEW
DO WHILE !EOF()
? Customer->Lastname, Customer->City
SET ALTERNATE OFF
Files Library is CLIPPER.LIB.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson