Recording messages and print statements in a textfile during program execution.

Manfred Schwab msw at iee.lu
Thu Sep 16 06:36:27 EDT 2004


Recording messages and print statements in a textfile during program
execution.


Is there a similar command to redirect errormessages or print statements
into a standart asciifile during programm execution.
I would like to echo the complete console output into a textfile and
send this file as email at a certain point in time.
The programm execution shall not be stopped.

As an example take a look at the description below. Set alternate on is
a command from the programming language clipper / dbase / flagship


Manfred




SET ALTERNATE
 Echo console output to a text file
------------------------------------------------------------------------------

 Syntax

     SET ALTERNATE TO [<xcFile> [ADDITIVE]]
     SET ALTERNATE on | OFF | <xlToggle>

 Arguments

     TO <xcFile> opens a standard ASCII text file for output with a
     default extension of (.txt).  The filename may optionally include
an
     extension, drive letter, and/or path.  You may specify <xcFile>
either
     as a literal filename or as a character expression enclosed in
     parentheses.  Note that if a file with the same name exists, it is
     overwritten.

     ADDITIVE causes the specified alternate file to appended to instead

     of 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.

 Description

     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.

 Examples

     .  This example creates an alternate file and writes the results
        of the ? command to the file for each record in the Customer
database
        file:


        # determine outputfile
        SET ALTERNATE TO Listfile

        # start recording
        SET ALTERNATE ON

        USE Customer NEW
        DO WHILE !EOF()
           ? Customer->Lastname, Customer->City
           SKIP
        ENDDO

        # stop recording
        SET ALTERNATE OFF

        # close recordfile
        CLOSE ALTERNATE


        CLOSE Customer

 Files:  Library is CLIPPER.LIB.

--
This e-mail may contain trade secrets or privileged, undisclosed or
otherwise confidential information. If you are not the intended
recipient and  have received this e-mail in error, you are hereby
notified that any review, copying or distribution of it is strictly
prohibited. Please inform us immediately and destroy the original
transmittal from your system. Thank you for your co-operation.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040916/ff69b111/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: msw.vcf
Type: text/x-vcard
Size: 348 bytes
Desc: Card for Manfred Schwab
URL: <http://mail.python.org/pipermail/python-list/attachments/20040916/ff69b111/attachment.vcf>


More information about the Python-list mailing list