]> granicus.if.org Git - icu/commitdiff
ICU-8579 added u_printf_u and u_get_stdout
authorAbhinav Gupta <mail@abhinavg.net>
Mon, 19 Sep 2011 17:58:14 +0000 (17:58 +0000)
committerAbhinav Gupta <mail@abhinavg.net>
Mon, 19 Sep 2011 17:58:14 +0000 (17:58 +0000)
X-SVN-Rev: 30685

icu4c/source/io/unicode/ustdio.h
icu4c/source/io/uprintf.c

index cae7d9baf8a03cbec7fc9fa950cc7e846b78ae98..145b1f44b0a8c75e7786cf231686780ebc84a51a 100644 (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.
index deea3e0943081bd7c56951395788b4374d882f64..01e9c6ba1d973224ff99118f2e37d44a89bf9056 100644 (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,