Name

strfmon
- convert monetary value to a string

Library

libc.lib

Synopsis

  #include <monetary.h>
  ssize_t strfmon (char * restrict s, size_t maxsize, const char * restrict format, ...);

Return values

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 by s, not including the terminating NULL byte. Otherwise, -1 is returned, the contents of the array are indeterminate, and errno is set to indicate the error.

Detailed description

The strfmon function places characters into the array pointed to by s as controlled by the string pointed to by format. No more than maxsize bytes are placed into the array.

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:


Examples

#include <string.h>
#include <stdio.h>
#include <monetary.h>
int main()
{
    char buf[50];
    strfmon(buf, sizeof(buf), "[%^=*#6n] [%=*#6i]",1234.567, 1234.567);
    printf("%s\n",buf);
}

         

Output

[ **1234.57] [ **1234.57]

         

Errors

The strfmon function will fail if:
[E2BIG]
  Conversion stopped due to lack of space in the buffer.
[EINVAL]
  The format string is invalid.
[ENOMEM]
  Not enough memory for temporary buffers.

See also

localeconv

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top