qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CLOSE Statement
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Closes one or more open files or devices.
 
CLOSE [[#]filenumber%[,[#]filenumber%]...]
 
    ■ filenumber%    The number of an open file or device.
 
    ■ CLOSE with no arguments closes all open files and devices.
 
Example:
    CLS
    INPUT "Enter filename: ", n$
    OPEN n$ FOR OUTPUT AS #1
    PRINT #1, "This is saved to the file."
    CLOSE
    OPEN n$ FOR INPUT AS #1
    INPUT #1, a$
    PRINT "Read from file: "; a$
    CLOSE
 
See Also    END    OPEN    RESET    STOP