xHarbour Reference Documentation > Command Reference |
Records the console output in a text file.
SET ALTERNATE TO [<fileName> [ADDITIVE]] or SET ALTERNATE on | OFF | ( <lOnOff> )
The SET ALTERNATE command writes console output to an ASCII text file with the default extension .TXT. The file is created as a new file unless the ADDITIVE option is used. Output to the file starts when SET ALTERNATE ON is executed and it ends with SET ALTERNATE OFF. The latter does not close the file but stops recording output. The file can be closed with CLOSE ALTERNATE, CLOSE ALL or SET ALTERNATE TO with no argument.
Some commands which display output to the console view have a TO FILE clause. It has the same result as the SET ALTERNATE command. A full-screen command such as @...SAY can not be echoed to a file. Instead, use SET PRINTER TO <xcFile> with SET DEVICE TO PRINTER to enable this.
Note: alternate files are not related to work areas. Therefore, only one file can be open with SET ALTERNATE at any time.
See also: | CLOSE, FCreate(), FOpen(), FWrite(), Set(), SET CONSOLE, SET PRINTER |
Category: | Console commands |
Source: | rtl\console.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// This example creates an alternate file and writes the results // of the ? command to the file: PROCEDURE Main SET ALTERNATE TO MyFile SET ALTERNATE ON USE Employees NEW DO WHILE !EOF() ? Employees->Name SKIP ENDDO SET ALTERNATE OFF CLOSE ALTERNATE CLOSE Employees RETURN
http://www.xHarbour.com