November 2003
Beginner to intermediate
480 pages
15h 3m
English
write — write data
Writes data to a file, optionally coercing the data to a desired datatype. There are options for where to start and how much data to write.
The data coercion options for reading and writing allow you to store any kind of data in a text file and retrieve it later. The data is encoded, but it will be decoded correctly if you specify the same class when writing and when reading.
open for access f with write permission
write {"Mannie", "Moe", "Jack"} as list to f
close access f
open for access f
set L to read f as list
close access f
L -- {"Mannie", "Moe", "Jack"}On the whole, however, this approach is not very flexible; see Section 9.6.2.
Read now
Unlock full access