WriteBytes(id, data$[, len])
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.
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".