Top
Back: Float
Forward: freemodule
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.46 fprintf

Procedure from library standard.lib (see standard_lib).

Syntax:
fprintf ( link_expression, string_expression [, any_expressions] )

Return:
none

Purpose:
fprintf(l,fmt,...); performs output formatting. The second argument is a format control string. Additional arguments may be required, depending on the content of the control string. A series of output characters is generated as directed by the control string; these characters are written to the link l. The control string fmt is simply text to be copied, except that the string may contain conversion specifications.
Type help print; for a listing of valid conversion specifications. As an addition to the conversions of print, the %n and %2 conversion specification does not consume an additional argument, but simply generates a newline character.

Note:
If one of the additional arguments is a list, then it should be enclosed once more into a list() command, since passing a list as an argument flattens the list by one level.

Example:
 
  ring r=0,(x,y,z),dp;
module m=[1,y],[0,x+z];
intmat M=betti(mres(m,0));
list l=r,m,M;
link li="";   // link to stdout
fprintf(li,"s:%s,l:%l",1,2);
==> s:1,l:int(2)
fprintf(li,"s:%s",l);
==> s:(QQ),(x,y,z),(dp(3),C)
fprintf(li,"s:%s",list(l));
==> s:(QQ),(x,y,z),(dp(3),C),y*gen(2)+gen(1),x*gen(2)+z*gen(2),1,1 
fprintf(li,"2l:%2l",list(l));
==> 2l:list("(QQ),(x,y,z),(dp(3),C)",
==> module(y*gen(2)+gen(1),
==> x*gen(2)+z*gen(2)),
==> intmat(intvec(1,1 ),1,2))
==> 
fprintf(li,"%p",list(l));
==> [1]:
==>    // coefficients: QQ
==> // number of vars : 3
==> //        block   1 : ordering dp
==> //                  : names    x y z
==> //        block   2 : ordering C
==> [2]:
==>    _[1]=y*gen(2)+gen(1)
==>    _[2]=x*gen(2)+z*gen(2)
==> [3]:
==>    1,1 
fprintf(li,"%;",list(l));
==> [1]:
==>    // coefficients: QQ
==> // number of vars : 3
==> //        block   1 : ordering dp
==> //                  : names    x y z
==> //        block   2 : ordering C
==> [2]:
==>    _[1]=y*gen(2)+gen(1)
==>    _[2]=x*gen(2)+z*gen(2)
==> [3]:
==>    1,1 
==> 
fprintf(li,"%b",M);
==>            0     1
==> ------------------
==>     0:     1     1
==> ------------------
==> total:     1     1
==> 
See also: print; printf; sprintf; string.


Top Back: Float Forward: freemodule FastBack: Functions and system variables FastForward: Control structures Up: Functions Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 4.3.1, 2022, generated by texi2html.