s$ = ReadString(id[, length, encoding])
id
. The optional length
argument allows you to specify the number of characters to read from the file.
If it is omitted, all characters from the current file cursor position until the end
will be read and returned. The file cursor will be advanced by the number of
bytes read from the file. This is not necessarily the same as the character
count passed in length
because in UTF-8 a single character may use up to
4 bytes.
The optional encoding
parameter can be used to set the character encoding
to use. This defaults to the default string encoding set using SetDefaultEncoding().
See Character encodings for details.
This function is used for reading text from files. If you need to read binary data from a file, use the ReadBytes() function instead. See ReadBytes for details.