printf
, fprintf
, sprintf
printf
は書式文字列 format にしたがい, オブジェクト args を標準出力に書き出す.
fprintf
は結果を, ファイル記述子 fd の指すファイルに書き出す.
sprintf
は結果を文字列で返し, 標準出力には書き出さない.
%a
(any) が利用可能.
args の個数は書式文字列の中の %a
の個数に等しくすること.
open_file
関数を用いて得ること.
[0] printf("%a: rat = %a\n",10,x^2-1)$ 10: rat = x^2-1 [1] S=sprintf("%a: rat = %a",20,x^2-1)$ [2] S; 20: rat = x^2-1 [3] Fd=open_file("hoge.txt","w"); 0 [4] fprintf(Fd,"Poly=%a\n",(x-1)^3)$ [5] close_file(Fd)$ [6] quit; $ cat hoge.txt Poly=x^3-3*x^2+3*x-1
ChangeLog
%a
は Maple の sprintf の真似か.
Go to the first, previous, next, last section, table of contents.