ICU-8579 added u_printf_u and u_get_stdout

X-SVN-Rev: 30685
This commit is contained in:
Abhinav Gupta 2011-09-19 17:58:14 +00:00
parent 42a46a6e1e
commit df03c9748c
2 changed files with 32 additions and 1 deletions

View file

@ -482,6 +482,25 @@ u_vfprintf(UFILE *f,
const char *patternSpecification,
va_list ap);
/**
* Write formatted data to <TT>stdout</TT>.
* @param patternSpecification A pattern specifying how <TT>u_printf_u</TT> will
* interpret the variable arguments received and format the data.
* @return The number of Unicode characters written to <TT>stdout</TT>
* @draft ICU 49
*/
U_DRAFT int32_t U_EXPORT2
u_printf_u(const UChar *patternSpecification,
... );
/**
* Get a UFILE for <TT>stdout</TT>.
* @return UFILE that writes to <TT>stdout</TT>
* @draft ICU 49
*/
U_DRAFT UFILE * U_EXPORT2
u_get_stdout();
/**
* Write formatted data to a UFILE.
* @param f The UFILE to which to write.

View file

@ -46,7 +46,7 @@ static UBool U_CALLCONV uprintf_cleanup()
return TRUE;
}
static UFILE * U_EXPORT2
U_CAPI UFILE * U_EXPORT2
u_get_stdout()
{
if (gStdOut == NULL) {
@ -141,6 +141,18 @@ u_fprintf_u( UFILE *f,
return count;
}
U_CAPI int32_t U_EXPORT2
u_printf_u(const UChar *patternSpecification,
...)
{
va_list ap;
int32_t count;
va_start(ap, patternSpecification);
count = u_vfprintf_u(u_get_stdout(), patternSpecification, ap);
va_end(ap);
return count;
}
U_CAPI int32_t U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov 2001 */
u_vfprintf( UFILE *f,
const char *patternSpecification,