Home Online Manual
Back: rank
Forward: reduce
FastBack: Functions and system variables
FastForward: Control structures
Up: Functions
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.1.123 read

read ( link_expression )
for DBM links:
read ( link_expression )
read ( link_expression, string_expression )
reads data from a link.
For ASCII links, the content of the entire file is returned as a string. If the ASCII link is the empty string, read reads from standard input.
For ssi links, one expression is read from the link and returned after evaluation. See Ssi links.
For ssi links the read command blocks as long as there is no data to be read from the link. The status command can be used to check whether or not there is data to be read.
For DBM links, a read with one argument returns the value of the next entry in the data base, and a read with two arguments returns the value to the key given as the second argument from the data base. See DBM links.
  ring r=32003,(x,y,z),dp;
  ideal i=x+y,z3+22y;
  // write the ideal i to the file save_i
  write(":w save_i",i);
  ring r0=0,(x,y,z),Dp;
  // create an ideal k equal to the content
  // of the file save_i
  string s="ideal k="+read("save_i")+";";
==> k[1]=x+y
==> k[2]=z3+22y
See execute; getdump; link; status; write.