write
data to
object at
offset
Object yields an object with an appropriate I/O manager. Offset yields an integer
.
write address to file "MyFile"
write "first line" & newline & "second line" to file "TwoLiner"
write steve to file "MyFile" at -15
The write
command copies the specified data to the specified object, which must be opened already with the open
command. Writing starts at the specified offset or, if no offset is specified, from where the last read
or write
left off. A negative offset indicates an offset from the end of the file, while a positive offset indicates an offset from the beginning of the file.
In HyperTalk, in OpenXION 1.2 or later, and according to the XION Scripting Language Standard, if you write to a file without specifying an offset and without having previously read from, written to, or truncated the file, the file will automatically get truncated before the data is written. Otherwise, the file will not be automatically truncated and any data that was not overwritten will remain.
OpenXION 1.0 and 1.1 did not automatically truncate files, requiring the use of the truncate
command before writing to files. This was a bug, not a feature, and was fixed in OpenXION 1.2.