Name
WriteBytes -- write bytes to file (V7.0)
Synopsis
WriteBytes(id, data$[, len])
Function
This function writes len bytes from the string data$ to the file specified by id. If the optional argument len is omitted, the complete string will be written to the file. WriteBytes() will advance the file cursor position by the number of bytes written.

This function is useful for writing binary data to a file. The string specified by data$ will be treated as raw binary data instead of text.

Inputs
id
file to write to
data$
data to write to file
len
optional: number of bytes to write (defaults to 0 which means write the complete string)
Example
size = FileSize("test")
OpenFile(1, "test")
OpenFile(2, "copy_of_test", #MODE_WRITE)
data$ = ReadBytes(1, size)
WriteBytes(2, data$, size)
CloseFile(2)
CloseFile(1)
The above code makes a copy of the file "test" and saves it as "copy_of_test".

Show TOC