up previous next
2.2.23 Output to a File
The following example illustrates one way of saving CoCoA output to a file.

  Use R ::= QQ[t,x,y,z];
  I := Ideal(t^2-x,t^5-y,t^7-z);
  G := GBasis(I);
[t^2 - x, -tx^2 + y, -x^3 + ty, -xy + z, -ty^2 + x^2z, txz - y^2, y^3 - tz^2]
  D := OpenOFile("MyFile"); -- open "MyFile" for output from CoCoA
  Print G On D;  -- G is appended to the file "MyFile"
Text can be read from files using OpenIFile and Get , and commands can be executed from files using Source . One may also keep a log of a CoCoA session (see OpenLog )