| Main index | Section 3 | Options |
#include <monetary.h>
#include <monetary.h>
#include <xlocale.h>
The strfmon_l() function takes an explicit locale argument, whereas the strfmon() function uses the current global or per-thread locale.
The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream; and conversion specifications, each of which results in fetching zero or more subsequent arguments. Each conversion specification is introduced by the % character. After the %, the following appear in sequence:
| =f | A ' =' character followed by another character f which is used as the numeric fill character. |
| ^ | Do not use grouping characters, regardless of the current locale default. |
| + | Represent positive values by prefixing them with a positive sign, and negative values by prefixing them with a negative sign. This is the default. |
| amp;( | Enclose negative values in parentheses. |
| amp;! | Do not include a currency symbol in the output. |
| - | Left justify the result. Only valid when a field width is specified. |
| i | The double argument is formatted as an international monetary amount. |
| n | The double argument is formatted as a national monetary amount. |
| % | A '%' character is written. |
#include <stdio.h> #include <monetary.h> #include <locale.h>int main(void) { char string[100]; double money = 1234567.89;
if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL) { fprintf(stderr, "Unable to setlocale(). ); return (1); }
strfmon(string, sizeof(string) - 1, "%n", money); printf("%s , string);
return (0); }
| [E2BIG] | |
| Conversion stopped due to lack of space in the buffer. | |
| [EINVAL] | |
| The format string is invalid. | |
| [ENOMEM] | |
| Not enough memory for temporary buffers. | |
This manual page was written by Jeroen Ruigrok van der Werven <Mt asmodai@FreeBSD.org> based on the standards' text.
| STRFMON (3) | December 6, 2023 |
| Main index | Section 3 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Our grievance is not just against Unix itself, but against the cult of Unix zealots who defend and nurture it. They take the heat, disease, and pestilence as givens, and, as ancient shamans did, display their wounds, some self-inflicted, as proof of their power and wizardry. We aim, through bluntness and humor, to show them that they pray to a tin god, and that science, not religion, is the path to useful and friendly technology. | ” |
| — The Unix Haters' handbook | ||