Show/Hide Toolbars

XSharp

NoteThis command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available

Purpose

Write screen output to a text file.

Syntax

SET ALTERNATE TO [<cFileName> [ADDITIVE] ]

SET ALTERNATE ON | OFF | <lToggle>

 

Arguments

<cFileName>Specifies the name of the ASCII file where screen output is recorded. The name must contain the drive and path. The file name can be specified either as a literal file name or as a character expression in parentheses. When the file name is specified without a file extension, the extension ".TXT" is used by default.
 
ADDITIVEThe option ADDITIVE adds the screen output to the current contents of the file <cFileName> . Without this option, the contents of the file are deleted if the file already exists. If a file with the name <cFileName> does not exist, it is created.

 

<lToggle><lToggle> is a logical expression which must appear in parentheses. Instead of the logical expression, the option ON can be specified for the value .T. (true) or OFF for the value .F. (false). When .T. or ON is specified, screen output is recorded in the file <cFileName> .

Description

The command SET ALTERNATE opens an ASCII file to record screen output. Only screen output performed using commands like ? or LIST and functions like QOut() and QQOut() is written into the file. Commands containing the option TO FILE work like SET ALTERNATE. .

 

The alternate file (the ASCII file <cFileName> ) is not tied to a single work area, but can be used from all work areas. Output to the file is turned on or off by the options ON | OFF or the logical value of <lToggle> . An alternate file is defined by including a file name in the command SET ALTERNATE. When SET ALTERNATE TO is called without a specified file name, the currently open alternate file is closed and recording screen output to a file is no longer possible. The alternate file is also closed by the commands CLOSE ALTERNATE and CLOSE ALL.

Examples

 

FUNCTION Start
    USE Customers NEW
    SET ALTERNATE TO CustomerList.TXT
    SET CONSOLE OFF
    DO WHILE .NOT. Eof()
        ? Customers->LastName, Customers->FirstName
        ? Customers->Street
        ? Customers->City + ",", Customers->State, Customers->Zip
        ?
        SKIP
    ENDDO
    SET ALTERNATE TO
    SET CONSOLE ON
    USE
 
  RETURN

 

Assembly

XSharp.RT.DLL

 

See Also

SetAlternate(),SetAltFile(), SET CONSOLE