|  |  5.1.172 write 
See
 Data types;
 dump;
 eval;
 link;
 print;
 printf;
 quote;
 read;
 short.Syntax:write (link_expression,expression_list)for DBM links:
 
 write (link,string_expression,string_expression)
 write (link,string_expression)Type:none
Purpose:writes data to a link.
If the link is of type
 ASCII, all expressions are converted to
strings (and separated by a newline character) before they are
written. As a consequence, only such values which can be converted to a
string can be written to anASCIIlink.For ssi links,
ring-dependent expressions are written together with a ring
description. To prevent an evaluation of the expression before it is
written, the
 quotecommand (possibly together witheval)
can be used. Awriteblocks (i.e., does not return to the prompt),
as long as a ssi link is not ready for writing.For DBM links,
 writewith three arguments inserts the first
string as key and the second string as value into the dbm data
base.Called with two arguments, it deletes the entry with the key
specified by the string from the data base.
Example:|  | // write the values of the variables f and i as strings into
// the file "outfile" (overwrite it, if it exists)
write(":w outfile",f,i);
// now append the string "that was f,i" (without the quotes)
// at the end of the file "outfile"
write(":a outfile","that was f,i");
// alternatively, links could be used:
link l=":a outfile"; l;
// type : ASCII
// mode : a
// name : outfile
// open : no
// read : not ready
// write: not ready
write(l," that was f,i");
// saving and retrieving data (ASCII format):
ring r=32003,(x,y,z),dp;
ideal i=x+y,z3+22y;
write(":w save_i",i);// this writes x+y,z3+22y to the file save_i
ring r=32003,(x,y,z),dp;
string s=read("save_i");   //creates the string x+y,z3+22y
execute("ideal k="+s+";"); // this defines an ideal k which
                           // is equal to i.
// for large objects, the ssi format and ssi links are better:
write("ssi:w save_i.ssi",i);
def j=read("ssi:r save_i.ssi");
 | 
 
 |