plain characters
|
Plain characters are simply copied to the output stream.
|
conversion specifications
|
Each conversion results in fetching of zero or more arguments.
|
The Limbo compiler recognizes calls to these functions and checks that the arguments match the format specifications in number and type.
Example
Program
implement print;
include "sys.m";
sys: Sys;
include "draw.m";
print: module
{
init: fn(ctxt: ref Draw->Context, argv: list of string);
};
init(ctxt: ref Draw->Context, argv: list of string)
{
sys = load Sys sys->PATH;
sys->print("[%%%%]\t%%\n");
i : int = 16rab9cd;
sys->print("[%%#x]\t%#x\n", i);
sys->print("[%%#X]\t%#X\n", i);
r : real = 0.00000345;
sys->print("[%%e]\t%e\n", r);
sys->print("[%%E]\t%E\n", r);
sys->print("[%%g]\t%g\n", r);
sys->print("[%%G]\t%G\n", r);
i = -1;
sys->print("[%%d]\t%d\n", i);
sys->print("[%%ud]\t%ud\n", i);
}
Output Data
[%%] %
[%#x] 0xab9cd
[%#X] 0XAB9CD
[%e] 3.450000e-06
[%E] 3.450000E-06
[%g] 3.45e-06
[%G] 3.45E-06
[%d] -1
[%ud] 4294967295
Errors
Output longer than 256 bytes is truncated. See Also
Limbo System Module and open, create - open/create a file for reading or writing