Retro Rocket OS
BASIC-Powered Operating System
Loading...
Searching...
No Matches
READ$ Function
READ$(integer-expression)

Reads a full line of text from a file, using the file handle specified by the integer expression. Reading continues until a carriage return (newline) or the end of file is reached.


Examples

REM Open a file and print each line
fh = OPENIN("example.txt")
REPEAT
line$ = READ$(fh)
PRINT line$
UNTIL EOF(fh)
CLOSE fh
REM Load first line only
fh = OPENIN("config.ini")
first$ = READ$(fh)
PRINT "First line: "; first$
CLOSE fh

Notes

  • The handle must be valid and obtained from OPENIN or OPENUP.
  • Lines are terminated by carriage return (newline) markers in the file.
  • If the end of file is reached, the string may be empty; use EOF to detect this condition.
  • Binary files may return unexpected results since READ$ is line-oriented.

See also: OPENIN · OPENUP · EOF · READ · WRITE