Difference between revisions of "FileHandle.read"

From MiniScript Wiki
Jump to navigation Jump to search
(Created page with "The <c>read</c> method of the FileHandle class returns a string containing the file contents starting from the current position and reading until the end of the file or a...")
(No difference)

Revision as of 19:45, 23 January 2025

The read method of the FileHandle class returns a string containing the file contents starting from the current position and reading until the end of the file or a set number of code points.

Parameter Name Type Default Value Meaning
codePointCount number number of code points that need to be read in. Reads to the end of the file, if no parameter is supplied.

This will read the entire file into the variable data.

reader = file.open("fileToRead.txt", "r")
data = reader.read
reader.close