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...")
 
m
 
Line 14: Line 14:
 
reader.close
 
reader.close
 
</ms>
 
</ms>
 +
 +
[[Category:Mini Micro]]

Latest revision as of 02:14, 30 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