@@ -20,7 +20,7 @@ val fprintf : out_channel -> ('a, out_channel, unit) format -> 'a
20
20
[arg1] to [argN] according to the format string [format], and
21
21
outputs the resulting string on the channel [outchan].
22
22
23
- The format is a character string which contains two types of
23
+ The format string is a character string which contains two types of
24
24
objects: plain characters, which are simply copied to the output
25
25
channel, and conversion specifications, each of which causes
26
26
conversion and printing of arguments.
@@ -31,20 +31,23 @@ val fprintf : out_channel -> ('a, out_channel, unit) format -> 'a
31
31
32
32
In short, a conversion specification consists in the [%] character,
33
33
followed by optional modifiers and a type which is made of one or
34
- two characters. The types and their meanings are:
34
+ two characters.
35
35
36
- - [d], [i], [n], [l], [L], or [N]: convert an integer argument to
37
- signed decimal.
38
- - [u]: convert an integer argument to unsigned decimal.
36
+ The types and their meanings are:
37
+
38
+ - [d], [i]: convert an integer argument to signed decimal.
39
+ - [u], [n], [l], [L], or [N]: convert an integer argument to
40
+ unsigned decimal. Warning: [n], [l], [L], and [N] are
41
+ used for [scanf], and should not be used for [printf].
39
42
- [x]: convert an integer argument to unsigned hexadecimal,
40
43
using lowercase letters.
41
44
- [X]: convert an integer argument to unsigned hexadecimal,
42
45
using uppercase letters.
43
46
- [o]: convert an integer argument to unsigned octal.
44
47
- [s]: insert a string argument.
45
- - [S]: insert a string argument in OCaml syntax (double quotes, escapes).
48
+ - [S]: convert a string argument to OCaml syntax (double quotes, escapes).
46
49
- [c]: insert a character argument.
47
- - [C]: insert a character argument in OCaml syntax (single quotes, escapes).
50
+ - [C]: convert a character argument to OCaml syntax (single quotes, escapes).
48
51
- [f]: convert a floating-point argument to decimal notation,
49
52
in the style [dddd.ddd].
50
53
- [F]: convert a floating-point argument to OCaml syntax ([dddd.]
@@ -54,37 +57,40 @@ val fprintf : out_channel -> ('a, out_channel, unit) format -> 'a
54
57
- [g] or [G]: convert a floating-point argument to decimal notation,
55
58
in style [f] or [e], [E] (whichever is more compact).
56
59
- [B]: convert a boolean argument to the string [true] or [false]
57
- - [b]: convert a boolean argument (for backward compatibility ; do not
58
- use in new programs).
60
+ - [b]: convert a boolean argument (deprecated ; do not use in new
61
+ programs).
59
62
- [ld], [li], [lu], [lx], [lX], [lo]: convert an [int32] argument to
60
63
the format specified by the second letter (decimal, hexadecimal, etc).
61
64
- [nd], [ni], [nu], [nx], [nX], [no]: convert a [nativeint] argument to
62
65
the format specified by the second letter.
63
66
- [Ld], [Li], [Lu], [Lx], [LX], [Lo]: convert an [int64] argument to
64
67
the format specified by the second letter.
65
- - [a]: user-defined printer. Takes two arguments and applies the
68
+ - [a]: user-defined printer. Take two arguments and apply the
66
69
first one to [outchan] (the current output channel) and to the
67
70
second argument. The first argument must therefore have type
68
71
[out_channel -> 'b -> unit] and the second ['b].
69
72
The output produced by the function is inserted in the output of
70
73
[fprintf] at the current point.
71
- - [t]: same as [%a], but takes only one argument (with type
74
+ - [t]: same as [%a], but take only one argument (with type
72
75
[out_channel -> unit]) and apply it to [outchan].
73
76
- [\{ fmt %\}]: convert a format string argument. The argument must
74
77
have the same type as the internal format string [fmt].
75
- - [( fmt %)]: format string substitution. Takes a format string
76
- argument and substitutes it to the internal format string [fmt]
78
+ - [( fmt %)]: format string substitution. Take a format string
79
+ argument and substitute it to the internal format string [fmt]
77
80
to print following arguments. The argument must have the same
78
81
type as the internal format string [fmt].
79
82
- [!]: take no argument and flush the output.
80
83
- [%]: take no argument and output one [%] character.
81
- - [,]: the no-op delimiter for conversion specifications.
84
+ - [\@]: take no argument and output one [\@] character.
85
+ - [,]: take no argument and do nothing.
82
86
83
87
The optional [flags] are:
84
88
- [-]: left-justify the output (default is right justification).
85
89
- [0]: for numerical conversions, pad with zeroes instead of spaces.
86
- - [+]: for numerical conversions, prefix number with a [+] sign if positive.
87
- - space: for numerical conversions, prefix number with a space if positive.
90
+ - [+]: for signed numerical conversions, prefix number with a [+]
91
+ sign if positive.
92
+ - space: for signed numerical conversions, prefix number with a
93
+ space if positive.
88
94
- [#]: request an alternate formatting style for numbers.
89
95
90
96
The optional [width] is an integer indicating the minimal
0 commit comments