/************************************************************************ * * * Copyright Digital Equipment Corporation 1998. All rights reserved. * * * * Restricted Rights: Use, duplication, or disclosure by the U.S. * * Government is subject to restrictions as set forth in subparagraph * * (c) (1) (ii) of DFARS 252.227-7013, or in FAR 52.227-19, or in FAR * * 52.227-14 Alt. III, as applicable. * * * * This software is proprietary to and embodies the confidential * * technology of Digital Equipment Corporation. Possession, use, or * * copying of this software and media is authorized only pursuant to a * * valid written license from Digital or an authorized sublicensor. * * * ************************************************************************/ /* strfmon_example.c */ #include #include #include #include #include #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); }