qb45advr.hlp (Topic list)
LINE INPUT Statement Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
LINE INPUT Statement Programming Example
 
The following program enables the user to enter text in a notes file.
The LINE INPUT statement allows you to enter any characters, including
those (such as a comma) that are delimiters in a regular INPUT statement.
 
'Opens and writes lines to a notes file until you
'enter a blank line.
DO
    CLS
    PRINT "Enter text. To stop, press <RETURN> without ";
    PRINT "entering any new text." : PRINT
    OPEN "NOTES.TXT" FOR OUTPUT AS #1
 
    ' Take lines until a blank line is entered.
    DO
        LINE INPUT "->";Inline$
        IF Inline$ <> "" THEN PRINT #1, Inline$
    LOOP WHILE Inline$ <> ""
    CLS : CLOSE #1
 
' Echo the notes back and see if they are correct.
    OPEN "NOTES.TXT" FOR INPUT AS #1
    PRINT "You entered: " : PRINT
    DO WHILE NOT EOF(1)
        LINE INPUT #1, Inline$
        PRINT Inline$
    LOOP
    CLOSE #1
    PRINT : INPUT "Is this correct (Y/N)"; R$
 
LOOP WHILE UCASE$(R$)="N"
END