os/ossrv/genericopenlibs/openenvcore/include/monetary.dosc
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /** @file  ../include/monetary.h
     2 @internalComponent
     3 */
     4 
     5 
     6 /** @fn  strfmon(char *  s, size_t maxsize, const char *  format, ...)
     7 @param s
     8 @param maxsize
     9 @param format
    10 @param ...
    11 @return   If the total number of resulting bytes including the terminating NULL byte is not more than maxsize , strfmon returns the number of bytes placed into the array pointed to 
    12 by s , not including the terminating NULL byte. Otherwise -1 is returned, the contents of the array are indeterminate 
    13 and errno is set to indicate the error.
    14 
    15 @code
    16  = f A ' = '
    17  character followed by another character f which is used as the numeric fill character.
    18  ^ Do not use grouping characters, regardless of the current locale default.
    19  + Represent positive values by prefixing them with a positive sign,
    20  and negative values by prefixing them with a negative sign.
    21  This is the default.
    22  ( Enclose negative values in parentheses.
    23  ! Do not include a currency symbol in the output.
    24  - Left justify the result.
    25  Only valid when a field width is specified.
    26 
    27 @endcode
    28 @code
    29  i The double
    30  argument is formatted as an international monetary amount.
    31  n The double
    32  argument is formatted as a national monetary amount.
    33  % A '%'
    34  character is written.
    35 
    36 @endcode
    37   The strfmon function places characters into the array pointed to by s as controlled by the string pointed to by format .
    38 No more than maxsize bytes are placed into the array.
    39 
    40  The format string is composed of zero or more directives:
    41 ordinary characters (not \% ),
    42 which are copied unchanged to the output stream; and conversion
    43 specifications, each of which results in fetching zero or more subsequent
    44 arguments.
    45 Each conversion specification is introduced by the \% character.
    46 After the \% ,
    47 the following appear in sequence: Zero or more of the following flags: = f A ' = '
    48 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,
    49 and negative values by prefixing them with a negative sign.
    50 This is the default. ( Enclose negative values in parentheses. ! Do not include a currency symbol in the output. - Left justify the result.
    51 Only valid when a field width is specified. An optional minimum field width as a decimal number.
    52 By default, there is no minimum width. A ' \# '
    53 sign followed by a decimal number specifying the maximum
    54 expected number of digits after the radix character. A ' . '
    55 character followed by a decimal number specifying the number
    56 the number of digits after the radix character. One of the following conversion specifiers: i The double
    57 argument is formatted as an international monetary amount. n The double
    58 argument is formatted as a national monetary amount. \% A '\%'
    59 character is written.
    60 
    61 Examples:
    62 @code
    63 #include <string.h>
    64 #include <stdio.h>
    65 #include <monetary.h>
    66 int main()
    67 {
    68     char buf[50];
    69     strfmon(buf, sizeof(buf), "[%^=*#6n] [%=*#6i]",1234.567, 1234.567);
    70     printf("%s
    71 ",buf);
    72 }
    73 
    74 @endcode
    75  Output
    76 @code
    77 [ **1234.57] [ **1234.57]
    78 
    79 @endcode
    80 @see localeconv()
    81 
    82 
    83  
    84 
    85 @publishedAll
    86 @externallyDefinedApi
    87 */