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