Name
WriteChr -- write a character to a file
Synopsis
WriteChr(id, chr[, encoding])
Function
Writes the character specified by chr to the file specified by id and increments the file cursor by the number of bytes written. The character to be written has to be passed to WriteChr() as a code point value. Note that depending on the encoding, this function might write up to 4 bytes to the file 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.

If you need to write a single byte to a file, use the WriteByte() function instead. See WriteByte for details.

Inputs
id
identifier specifying the file to use
chr
code point value of character to write to file
encoding
optional: character encoding to use (defaults to default string encoding) (V7.0)
Example
OpenFile(1, "Test", #MODE_WRITE)
WriteChr(1, 65)
CloseFile()
This code writes the character "A" to the file Test.

Show TOC