version 1 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
STRFMON |
|
|
2 |
!!!STRFMON |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
EXAMPLE |
|
|
8 |
SEE ALSO |
|
|
9 |
---- |
|
|
10 |
!!NAME |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
strfmon - convert monetary value to a string |
|
|
14 |
!!SYNOPSIS |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
__#include |
|
|
18 |
__''s''__, size_t__ ''max''__, const char *__''format''__, |
|
|
19 |
...); |
|
|
20 |
__ |
|
|
21 |
!!DESCRIPTION |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
The __strfmon()__ function formats the specified amounts |
|
|
25 |
according to the format specification ''format'' and |
|
|
26 |
places the result in the character array ''s'' of size |
|
|
27 |
''max''. |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
Ordinary characters in ''format'' are copied to ''s'' |
|
|
31 |
without conversion. Conversion specifiers are introduced by |
|
|
32 |
a `%' character. Immediately following it there can be zero |
|
|
33 |
or more of the following flags: |
|
|
34 |
|
|
|
35 |
|
|
|
36 |
__=__''f'' |
|
|
37 |
|
|
|
38 |
|
|
|
39 |
The single-byte character ''f'' is used as the numeric |
|
|
40 |
fill character (to be used with a left precision, see |
|
|
41 |
below). When not specified, the space character is |
|
|
42 |
used. |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
__^__ |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
Do not use any grouping characters that might be defined for |
|
|
49 |
the current locale. By default, grouping is |
|
|
50 |
enabled. |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
__(__ or __+__ |
|
|
54 |
|
|
|
55 |
|
|
|
56 |
The ( flag indicates that negative amounts should be |
|
|
57 |
enclosed between parentheses. The + flag indicates that |
|
|
58 |
signs should be handled in the default way, that is, amounts |
|
|
59 |
are preceded by the locale's sign indication, e.g., nothing |
|
|
60 |
for positive, |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
__!__ |
|
|
64 |
|
|
|
65 |
|
|
|
66 |
Omit the currency symbol. |
|
|
67 |
|
|
|
68 |
|
|
|
69 |
__-__ |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
Left justify all fields. The default is right |
|
|
73 |
justification. |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
Next, there may be a field width: a decimal digit string |
|
|
77 |
specifying a minimum field width in bytes. The default is 0. |
|
|
78 |
A result smaller than this width is padded with spaces (on |
|
|
79 |
the left, unless the left-justify flag was |
|
|
80 |
given). |
|
|
81 |
|
|
|
82 |
|
|
|
83 |
Next, there may be a left precision of the form |
|
|
84 |
|
|
|
85 |
|
|
|
86 |
Next, there may be a right precision of the form |
|
|
87 |
frac_digits'' and ''int_frac_digits'' items of the |
|
|
88 |
current locale. If the right precision is 0, no radix |
|
|
89 |
character is printed. (The radix character here is |
|
|
90 |
determined by LC_MONETARY, and may differ from that |
|
|
91 |
specified by LC_NUMERIC.) |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
Finally, the conversion specification must be ended with a |
|
|
95 |
conversion character. The three conversion characters |
|
|
96 |
are |
|
|
97 |
|
|
|
98 |
|
|
|
99 |
__%__ |
|
|
100 |
|
|
|
101 |
|
|
|
102 |
(In this case the entire specification must be exactly |
|
|
103 |
|
|
|
104 |
|
|
|
105 |
__i__ |
|
|
106 |
|
|
|
107 |
|
|
|
108 |
One argument of type double is converted using the locale's |
|
|
109 |
international currency format. |
|
|
110 |
|
|
|
111 |
|
|
|
112 |
__n__ |
|
|
113 |
|
|
|
114 |
|
|
|
115 |
One argument of type double is converted using the locale's |
|
|
116 |
national currency format. |
|
|
117 |
!!RETURN VALUE |
|
|
118 |
|
|
|
119 |
|
|
|
120 |
The __strfmon()__ function returns the number of |
|
|
121 |
characters placed in the array ''s'', not including the |
|
|
122 |
terminating NUL character, provided the string, including |
|
|
123 |
the terminating NUL, fits. Otherwise, it sets ''errno'' |
|
|
124 |
to E2BIG, returns -1, and the contents of the array is |
|
|
125 |
undefined. |
|
|
126 |
!!EXAMPLE |
|
|
127 |
|
|
|
128 |
|
|
|
129 |
The call |
|
|
130 |
|
|
|
131 |
|
|
|
132 |
strfmon(buf, sizeof(buf), |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
outputs |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
[[ fl **1234,57] [[ NLG **1 234,57] |
|
|
139 |
|
|
|
140 |
|
|
|
141 |
in the Dutch locale (with fl for |
|
|
142 |
|
|
|
143 |
|
|
|
144 |
[[ L. **1235] [[ ITL **1.235] |
|
|
145 |
[[ $**1234.57] [[ AUD **1,234.57] |
|
|
146 |
[[Fr. **1234,57] [[CHF **1.234,57] |
|
|
147 |
[[ **1234$57Esc] [[ **1.234$57PTE ] |
|
|
148 |
!!SEE ALSO |
|
|
149 |
|
|
|
150 |
|
|
|
151 |
setlocale(3), sprintf(3), |
|
|
152 |
locale(7) |
|
|
153 |
---- |