A-126
Motorola DSP56000 Family Optimizing C Compiler User’s Manual
For More Information On This Product,
Go to: www.freescale.com
Motorola
A.4.126 vsprintf—Write formatted output to a string using a va_list
#include <stdio.h>
int vsprintf ( char *s, const char *format, va_list arg );
The function
vsprintf
is exactly the same as the function
printf
except that an
existing
va_list
is used in place of a series of arguments. The macro
va_start
must
have been invoked on the argument arg before the call to
vsprintf
is made.
vsprintf
returns the number of characters printed. On error,
vsprintf
returns a negative value.
Refer to the following sections for more information:
Section A.4.93, “sprintf—Print to a string,” on page A-96
Example A-119. vsprintf
#include <stdio.h>
int sprintf ( char *s, const char *format, ... )
{
va_list ap;
int result;
va_start ( ap, format );
result = vsprintf ( s, format, ap );
va_end ( ap );
return result;
}
is essentially the library function
sprintf
.
A.4.127 wcstombs—Convert wchar_t array to multibyte string
#include <stdlib.h>
size_t wcstombs( char* s, const wchar_t* pwcs, size_t n );
The
wcstombs
function converts a wide character string pointed to by
pwcs
into the
character string pointed to by
s
. Each character of the wide character string is converted
into the corresponding
multibyte
character as if by the
wctomb
function. Conversion will
stop when
n
total characters have been converted or a null character is encountered. If
s
and
pwcs
overlap, the behavior is undefined.
If an invalid character is encountered,
wcstombs
returns (size_t) -1. Otherwise,
wcstombs
returns the number of characters converted not including the terminating
NULL
character, if any.
Note:
The DSP56000/DSP56001 does not provide byte addressing, thus characters
always require an entire word of memory each. One way to better utilize data
memory (with a run-time cost) is to combine the ANSI data type
wchar_t
and
the special ANSI multibyte and wide character library routines.
F
Freescale Semiconductor, Inc.
n
.