#include <stdlib.h> #include <stdio.h> #include <locale.h> #include <monetary.h> #include <errno.h> #define MAX_BUF_SIZE 124 main() { size_t ret; char buffer[MAX_BUF_SIZE]; double amount = 102593421; /* Display a monetary amount using the en_US.ISO8859-1 */ /* locale and a range of different display formats. */ if (setlocale(LC_ALL, "en_US.ISO8859-1") == (char *) NULL) { perror("setlocale"); exit(EXIT_FAILURE); } ret = strfmon(buffer, MAX_BUF_ SIZE, "International: %i\n", amount); printf(buffer); ret = strfmon(buffer, MAX_BUF_ SIZE, "National: %n\n", amount); printf(buffer); ret = strfmon(buffer, MAX_BUF_ SIZE, "National: %=*#10n\n", amount); printf(buffer); ret = strfmon(buffer, MAX_BUF_ SIZE, "National: %(n\n", -1 * amount); printf(buffer); ret = strfmon(buffer, MAX_BUF_ SIZE, "National: %^!n\n", amount); printf(buffer); } Running the example program produces the following result: International: USD 102,593,421.00 National: $102,593,421.00 National: $**102,593,421.00 National: ($102,593,421.00) National: 102593421.00