Name
ReadChr -- read a character from the specified file
Synopsis
chr = ReadChr(id[, encoding])
Function
This reads a single character from the file specified by id and returns its code point value. Note that depending on the character encoding, this might read up to 4 bytes from the file since in UTF-8, characters can use up to 4 bytes. The file cursor position is incremented by the number of bytes read.

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.

If you want to read a single byte from a file, use ReadByte() instead. See ReadByte for details.

Inputs
id
identifier of file to use
encoding
optional: character encoding to use (defaults to default string encoding) (V7.0)
Results
chr
next character from file stream
Example
OpenFile(1, "test", #MODE_READWRITE)
WriteLine(1, "Hello People! How are you?")
Seek(1, 0)
test = ReadChr(1)
CloseFile(1)
test$ = Chr(test)
Print(test$)
The above code will print "H" to the screen.

Show TOC