Contents  Index  
──────────────────────────────────────────────────────────────────────────────
Writes data to the screen or a sequential file.

WRITE [[#]filenumber%,] expressionlistfilenumber%       The number of an open sequential file. If the file
                        number is omitted, WRITE writes to the screen.
    ■ expressionlist    One or more variables or expressions, separated by
                        commas, whose values are written to the screen or
                        file.

    ■ WRITE inserts commas between items and quotation marks around strings
      as they are written. WRITE writes values to a file in a form that can
      be read by the INPUT statement.

Example:
    CLS
    OPEN "LIST" FOR OUTPUT AS #1
    DO
        INPUT "   NAME:       ", Name$
        INPUT "   AGE:        ", Age$
        WRITE #1, Name$, Age$
        INPUT "Add another entry"; R$
    LOOP WHILE UCASE$(R$) = "Y"
    CLOSE #1
    'Print the file to the screen.
    OPEN "LIST" FOR INPUT AS #1
    CLS
    PRINT "Entries in file:": PRINT
    DO WHILE NOT EOF(1)
        INPUT #1, Rec1$, Rec2$   'Read entries from file.
        PRINT Rec1$, Rec2$       'Print the entries on the screen.
    LOOP
    CLOSE #1
    KILL "LIST"

See Also    INPUT, LINE INPUT    OPEN    PRINT, LPRINT
──────────────────────────────────────────────────────────────────────────────
 © Copyright Microsoft Corporation, 1987-1992. All rights reserved.
   Converted from qbasic.hlp with DosHelp/HelpConvert