Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
CLOSE Keyword
CLOSE integer-variable

Closes an open file handle and flushes any pending writes.

Remarks
The parameter **must be an integer *variable*** that holds a valid file handle
previously returned by OPENIN,
OPENOUT, or
OPENUP.
A numeric literal or expression is not accepted.

Example
FH = OPENOUT("log.txt")
WRITE FH, "hello"
CLOSE FH

Notes
  • After CLOSE, the handle becomes invalid and must not be reused unless re-opened.
  • Closing an already-closed or never-opened handle raises a runtime error (trap with ON ERROR if needed).
  • All buffered data is written to storage before the handle is released.
  • Reading from or writing to a handle is only valid while it is open (see EOF for end-of-file checks).

See also: OPENIN, OPENOUT, OPENUP, WRITE, READ$, EOF