ReadString -- read string from file
s$ = ReadString(id[, length, encoding])
This function reads a string from the file specified by 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.

file to read data from
optional: characters to read or 0 to read all characters until the end of the file (defaults to 0)
optional: character encoding to use (defaults to default string encoding) (V7.0)
string that contains the characters read

Show TOC