<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to README</title><link>https://sourceforge.net/p/xprintf/wiki/README/</link><description>Recent changes to README</description><atom:link href="https://sourceforge.net/p/xprintf/wiki/README/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 02 Jul 2014 09:49:13 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/xprintf/wiki/README/feed" rel="self" type="application/rss+xml"/><item><title>README modified by Ruediger Helsch</title><link>https://sourceforge.net/p/xprintf/wiki/README/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -16,7 +16,7 @@
 - [Compatibility](#Compatibility)
 - [Format String, Conversion Specifications](#Format)
 - [Problems, Incompatibilities and Bugs](#Incompatibilities)
-- [StrCvt - Charcter conversion](strcvt)
+- [StrCvt - Charcter conversion](StrCvt)
 - [License](#License)

@@ -36,7 +36,7 @@
   streams and output strings, narrow and wide format strings, narrrow
   and wide arguments.
 - Seamless support for new `char16_t` and `char32_t` character and
-  string types using the included [StrCvt](strcvt) package
+  string types using the included [StrCvt](StrCvt) package
   for character type conversions.

 In C, the functions from the printf() family are used for formatted
@@ -139,9 +139,9 @@
 overhead and compilation time, a precompiled library can be used.
 See section [Creating a Library](#Library).

-Xprintf internally uses the included [StrCvt](trcvt)
+Xprintf internally uses the included [StrCvt](StrCvt)
 library for character type conversions of arguments and destination
-strings.  If you want to use the [StrCvt](strcvt) package
+strings.  If you want to use the [StrCvt](StrCvt) package
 directly, look there for information about StrCvt headers and
 namespaces.

@@ -192,7 +192,7 @@
   wide string.

 Generally all argument strings are converted (using the included
-[StrCvt](@ref md_strcvt) library) according to the conversion rules of
+[StrCvt](StrCvt) library) according to the conversion rules of
 the currently installed global locale.  For this conversion, narrow
 character strings are treated as locale-defined characters.  If
 strings are known to be in UTF-8 format instead of the locale-defined
@@ -484,7 +484,7 @@
   Unicode characters using Markus Kuhn's mk_wcswidth().

   Generally all argument strings are converted (using the included
-  [StrCvt](@ref md_strcvt) library) according to the conversion rules
+  [StrCvt](StrCvt) library) according to the conversion rules
   of the currently installed global locale.  For this conversion,
   narrow character strings are treated as locale-defined characters.
   If strings are known to be in UTF-8 format instead of the
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ruediger Helsch</dc:creator><pubDate>Wed, 02 Jul 2014 09:49:13 -0000</pubDate><guid>https://sourceforge.net0d14605838625488e395de35d4225a2d920fa617</guid></item><item><title>README modified by Ruediger Helsch</title><link>https://sourceforge.net/p/xprintf/wiki/README/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -21,7 +21,6 @@

-
 Introduction &lt;a name="Introduction"&gt;&lt;/a&gt;
 ------------

@@ -140,10 +139,10 @@
 overhead and compilation time, a precompiled library can be used.
 See section [Creating a Library](#Library).

-Xprintf internally uses the included [StrCvt](@ref md_strcvt)
-package for character type conversions of arguments and destination
-strings.  If you want to use the [StrCvt](@ref md_strcvt) package
-directly, look there for information about Charcvt headers and
+Xprintf internally uses the included [StrCvt](trcvt)
+library for character type conversions of arguments and destination
+strings.  If you want to use the [StrCvt](strcvt) package
+directly, look there for information about StrCvt headers and
 namespaces.

@@ -192,6 +191,15 @@
   stream, and the string assigned from the result can be a narrow or a
   wide string.

+Generally all argument strings are converted (using the included
+[StrCvt](@ref md_strcvt) library) according to the conversion rules of
+the currently installed global locale.  For this conversion, narrow
+character strings are treated as locale-defined characters.  If
+strings are known to be in UTF-8 format instead of the locale-defined
+character format, they can be defined as type `StrCvt::u8string`.
+Xprintf recognizes this string type and transforms these arguments
+according to the UTF transformations.
+

 Redirect default output stream &lt;a name="Redirect"&gt;&lt;/a&gt;
@@ -245,7 +253,7 @@
     // Simpler: use sxprintf(format, args...)
     my_fun(sxprintf("Result is %d", 42));
     // Pass wstring to my_fun(), using template argument
-    my_fun(sxprintf("Result is %d", 42));
+    my_fun(sxprintf("Result is %d", 42));
     // Equivalent: use wchar_t format
     my_fun(sxprintf(L"Result is %d", 42));
 ~~~
@@ -317,7 +325,7 @@
 - GCC 4.7, 4.8 and 4.9 on Linux
 - Visual Studio Express 2013 for Windows Desktop with November 2013 CTP
 - Intel C++ 14.0.2 on Linux
-- Clang 3.5 on Linux
+- Clang 3.5.0 on Linux

@@ -464,17 +472,25 @@
 - `s`, `S`

   Format the argument as a string of characters.  The argument must be
-  a C++ string type (`std::string`, `std::wstring`,
-  `std::basic_string` or `std::basic_string`) or a
-  C style null-terminated `char`, `wchar_t`, `char16_t` or `char32_t`
-  character pointer string.  For the C++ string types, the precision
-  specifies the maximum number of Unicode characters to output.  For
-  the C style null-terminated character pointer string types, the
-  precision specifies the maximum length of the string; if no
-  null-character is found after this number of source characters,
-  `precision` source characters are output.  For padding, the width of
-  the formatted string is estimated from the Unicode characters using
-  Markus Kuhn's mk_wcswidth().
+  a C++ string type (`std::string`, `std::wstring`, `std::u16string`
+  or `std::u32string`) or a C style null-terminated `char`, `wchar_t`,
+  `char16_t` or `char32_t` character pointer string.  For the C++
+  string types, the precision specifies the maximum number of Unicode
+  characters to output.  For the C style null-terminated character
+  pointer string types, the precision specifies the maximum length of
+  the string; if no null-character is found after this number of
+  source characters, `precision` source characters are output.  For
+  padding, the width of the formatted string is estimated from the
+  Unicode characters using Markus Kuhn's mk_wcswidth().
+
+  Generally all argument strings are converted (using the included
+  [StrCvt](@ref md_strcvt) library) according to the conversion rules
+  of the currently installed global locale.  For this conversion,
+  narrow character strings are treated as locale-defined characters.
+  If strings are known to be in UTF-8 format instead of the
+  locale-defined character format, they can be defined as type
+  `StrCvt::u8string`.  Xprintf recognizes this string type and
+  transforms these arguments according to the UTF transformations.

 - `p`

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ruediger Helsch</dc:creator><pubDate>Tue, 01 Jul 2014 23:31:28 -0000</pubDate><guid>https://sourceforge.netf462c97e87550f5349f9548024f765a227f41c2e</guid></item><item><title>README modified by Ruediger Helsch</title><link>https://sourceforge.net/p/xprintf/wiki/README/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -317,6 +317,7 @@
 - GCC 4.7, 4.8 and 4.9 on Linux
 - Visual Studio Express 2013 for Windows Desktop with November 2013 CTP
 - Intel C++ 14.0.2 on Linux
+- Clang 3.5 on Linux

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ruediger Helsch</dc:creator><pubDate>Mon, 30 Jun 2014 15:54:20 -0000</pubDate><guid>https://sourceforge.neta9d73bdc0289e0adedcec1cba3c799fe80930a0b</guid></item><item><title>README modified by Ruediger Helsch</title><link>https://sourceforge.net/p/xprintf/wiki/README/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -138,7 +138,7 @@
 Xprintf() is pre-configured for header-only use.  This means: Just
 include the proper header and you are done.  In order to reduce space
 overhead and compilation time, a precompiled library can be used.
-See section [Creating a Library](#library).
+See section [Creating a Library](#Library).

 Xprintf internally uses the included [StrCvt](@ref md_strcvt)
 package for character type conversions of arguments and destination
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ruediger Helsch</dc:creator><pubDate>Mon, 30 Jun 2014 15:48:20 -0000</pubDate><guid>https://sourceforge.netb5b360ba946b32aae6f65c852c1f798e3f520487</guid></item><item><title>README modified by Ruediger Helsch</title><link>https://sourceforge.net/p/xprintf/wiki/README/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -16,7 +16,7 @@
 - [Compatibility](#Compatibility)
 - [Format String, Conversion Specifications](#Format)
 - [Problems, Incompatibilities and Bugs](#Incompatibilities)
-- [StrCvt - Charcter conversion](@ref md_strcvt)
+- [StrCvt - Charcter conversion](strcvt)
 - [License](#License)

@@ -37,7 +37,7 @@
   streams and output strings, narrow and wide format strings, narrrow
   and wide arguments.
 - Seamless support for new `char16_t` and `char32_t` character and
-  string types using the included [StrCvt](@ref md_strcvt) package
+  string types using the included [StrCvt](strcvt) package
   for character type conversions.

 In C, the functions from the printf() family are used for formatted
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ruediger Helsch</dc:creator><pubDate>Sun, 29 Jun 2014 21:20:38 -0000</pubDate><guid>https://sourceforge.net6eede55d12c077e63c50063ad7d3e2bff4c2fb41</guid></item><item><title>README modified by Ruediger Helsch</title><link>https://sourceforge.net/p/xprintf/wiki/README/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="xprintf-printf-for-c11"&gt;Xprintf - printf for C++11&lt;/h1&gt;
&lt;h2 id="contents"&gt;Contents&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class="" href="#Introduction"&gt;Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#Installation"&gt;Installation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#Usage"&gt;Usage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#xprintf_format_args"&gt;xprintf(format, args...)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#Redirect"&gt;Redirect default stream&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#xprintf_stream_format_args"&gt;xprintf(stream, format, args...)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#sxprintf_format_args"&gt;sxprintf(format, args...)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#Library"&gt;Creating a Library&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#Compatibility"&gt;Compatibility&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#Format"&gt;Format String, Conversion Specifications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#Incompatibilities"&gt;Problems, Incompatibilities and Bugs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="../@ref%20md_strcvt"&gt;StrCvt - Charcter conversion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="" href="#License"&gt;License&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="introduction-wzxhzdk8wzxhzdk9"&gt;Introduction &lt;a name="Introduction"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This is an implementation of printf for C++11.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Full standard C printf() format support, most of Posix and X/Open&lt;br /&gt;
  extensions like positional parameters, seamless integration of C++&lt;br /&gt;
  strings.&lt;/li&gt;
&lt;li&gt;Full type safety, respects the type of the arguments. Argument size&lt;br /&gt;
  specifiers like &lt;code&gt;l&lt;/code&gt; are accepted but mostly ignored, since the type&lt;br /&gt;
  of the arguments is consulted for the size.&lt;/li&gt;
&lt;li&gt;Seamless support for arbitrary combinations of narrow and wide output&lt;br /&gt;
  streams and output strings, narrow and wide format strings, narrrow&lt;br /&gt;
  and wide arguments.&lt;/li&gt;
&lt;li&gt;Seamless support for new &lt;code&gt;char16_t&lt;/code&gt; and &lt;code&gt;char32_t&lt;/code&gt; character and&lt;br /&gt;
  string types using the included &lt;a class="" href="../@ref%20md_strcvt"&gt;StrCvt&lt;/a&gt; package&lt;br /&gt;
  for character type conversions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In C, the functions from the printf() family are used for formatted&lt;br /&gt;
text output and string formatting.&lt;/p&gt;
&lt;p&gt;C++ replaced this with the type-safe output stream model and its &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt;&lt;br /&gt;
operator, which offers the same formatting options but in a much more&lt;br /&gt;
verbous way.&lt;/p&gt;
&lt;p&gt;This library implements the well-known printf() interface for C++,&lt;br /&gt;
with full type safety.  It supports all the format strings of the&lt;br /&gt;
standard C library printf(), plus Posix extensions like positional&lt;br /&gt;
arguments.  Example syntax:&lt;/p&gt;
&lt;p&gt;~~~{.cpp}&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="c1"&gt;// Write to stream&lt;/span&gt;
&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;%d: %f&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;5.7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Format to string&lt;/span&gt;
&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="k"&gt;string&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Result: %d&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;42&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Or to wide character string&lt;/span&gt;
&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;wstring&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Question: how much, %s&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Default: output goes to standard output&lt;/span&gt;
&lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;%s&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;~~~&lt;/p&gt;
&lt;h2 id="installation-wzxhzdk10wzxhzdk11"&gt;Installation &lt;a name="Installation"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Unpack the distribution to a directory on your local machine.  You can&lt;br /&gt;
include the proper header in subdirectory &lt;code&gt;include/xprintf&lt;/code&gt; from your&lt;br /&gt;
program.  To make inclusion of the headers easier, it is recommended&lt;br /&gt;
to add the subdirectory &lt;code&gt;include&lt;/code&gt; of the Xprintf distribution to the&lt;br /&gt;
include file search path of the compiler.  This is commonly achieved&lt;br /&gt;
with the option &lt;code&gt;-I/path/to/xprintf/include&lt;/code&gt; (assuming that the&lt;br /&gt;
xprintf distribution has been upacked to directory&lt;br /&gt;
&lt;code&gt;/path/to/xprintf&lt;/code&gt;).  Then you can include the xprintf headers through&lt;br /&gt;
their standard names like &lt;code&gt;"xprintf/xprintf.h"&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="usage-wzxhzdk12wzxhzdk13"&gt;Usage &lt;a name="Usage"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In order to use Xprintf, the proper headers have to be&lt;br /&gt;
included.  These are:&lt;/p&gt;
&lt;p&gt;~~~{.cpp}&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="c1"&gt;// Normal xprintf() header:&lt;/span&gt;
&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="k"&gt;include&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;/path/to/xprintf/include/xprintf/xprintf.h&amp;quot;&lt;/span&gt;
&lt;span class="c1"&gt;// For use with FILE* as stream argument:&lt;/span&gt;
&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="k"&gt;include&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;/path/to/xprintf/include/xprintf/xprintf_file.h&amp;quot;&lt;/span&gt;
&lt;span class="c1"&gt;// For the standard function names like printf() and fprintf();&lt;/span&gt;
&lt;span class="p"&gt;#&lt;/span&gt;&lt;span class="k"&gt;include&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;/path/to/xprintf/include/xprintf/xprintf_std.h&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;~~~&lt;/p&gt;
&lt;p&gt;If the xprintf include directory &lt;code&gt;/path/to/xprintf/include&lt;/code&gt; has been&lt;br /&gt;
added to the include file search path of the compiler, e.g. using the&lt;br /&gt;
compiler option &lt;code&gt;-I/path/to/xprintf/include&lt;/code&gt;, this is reduced to:&lt;/p&gt;
&lt;p&gt;~~~{.cpp}&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="cp"&gt;#include &amp;quot;xprintf/xprintf.h&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;using&lt;/span&gt; &lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;XPrintf&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;~~~&lt;/p&gt;
&lt;p&gt;The xprintf() functions are exported through namespace &lt;code&gt;XPrintf&lt;/code&gt;.  It&lt;br /&gt;
is recommented to make them available via a &lt;code&gt;using namespace&lt;/code&gt;&lt;br /&gt;
directive like in the example above.  Alternatively it is possible to&lt;br /&gt;
import the functions xprintf() and sxprintf() separately through&lt;br /&gt;
&lt;code&gt;using&lt;/code&gt; declarations:&lt;/p&gt;
&lt;p&gt;~~~{.cpp}&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;using&lt;/span&gt; &lt;span class="n"&gt;XPrintf&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;using&lt;/span&gt; &lt;span class="n"&gt;XPrintf&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;sxprintf&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Optional&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;~~~&lt;/p&gt;
&lt;p&gt;Header "xprintf/xprintf_std.h" defines the C standard library names&lt;br /&gt;
fprintf(), printf(), snprintf(), sprintf(), fwprintf(), wprintf() and&lt;br /&gt;
swprintf() in namespace &lt;code&gt;XPrintfStd&lt;/code&gt;.  To import them into your&lt;br /&gt;
working namespace, you can again use a &lt;code&gt;using namespace&lt;/code&gt; directive:&lt;/p&gt;
&lt;p&gt;~~~{.cpp}&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="cp"&gt;#include &amp;quot;xprintf/xprintf_std.h&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;using&lt;/span&gt; &lt;span class="n"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;XPrintfStd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Hello, world!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;~~~&lt;/p&gt;
&lt;p&gt;This makes all the standard library names available through their&lt;br /&gt;
standard names.&lt;/p&gt;
&lt;p&gt;Xprintf() is pre-configured for header-only use.  This means: Just&lt;br /&gt;
include the proper header and you are done.  In order to reduce space&lt;br /&gt;
overhead and compilation time, a precompiled library can be used.&lt;br /&gt;
See section &lt;a class="" href="#library"&gt;Creating a Library&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Xprintf internally uses the included &lt;a class="" href="../@ref%20md_strcvt"&gt;StrCvt&lt;/a&gt;&lt;br /&gt;
package for character type conversions of arguments and destination&lt;br /&gt;
strings.  If you want to use the &lt;a class="" href="../@ref%20md_strcvt"&gt;StrCvt&lt;/a&gt; package&lt;br /&gt;
directly, look there for information about Charcvt headers and&lt;br /&gt;
namespaces.&lt;/p&gt;
&lt;h2 id="xprintfformat-args-wzxhzdk14wzxhzdk15"&gt;xprintf(format, args...) &lt;a name="xprintf_format_args"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The most flexible way to use xprintf() is through the call&lt;br /&gt;
&lt;code&gt;xprintf(format, args...)&lt;/code&gt;.  The expression &lt;code&gt;xprintf(format, args...)&lt;/code&gt;&lt;br /&gt;
can be used as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It can be used as argument to &lt;code&gt;operator&amp;lt;&amp;lt;&lt;/code&gt;, which writes the&lt;br /&gt;
  formatted result to the output stream.&lt;/li&gt;
&lt;li&gt;It can be assigned to a &lt;code&gt;string&lt;/code&gt; or &lt;code&gt;wstring&lt;/code&gt;, which receives the&lt;br /&gt;
  formatted output.&lt;/li&gt;
&lt;li&gt;The output can be left unused. In this case it is written to the&lt;br /&gt;
  standard output (or another stream, see below).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The diffent usages are shown here:&lt;/p&gt;
&lt;p&gt;~~~{.cpp}&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="c1"&gt;// Write to stream:&lt;/span&gt;
&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;%d: %f&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;5.7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Or to wide stream:&lt;/span&gt;
&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;wcout&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;%d: %f&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;5.7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;endl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;// Format to string:&lt;/span&gt;
&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="k"&gt;string&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Result: %d&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;42&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Or to wide character string:&lt;/span&gt;
&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;wstring&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Question: how much, %s&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Default: output goes to standard output (can be redirected)&lt;/span&gt;
&lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;%s&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Using a wide character format works as well.&lt;/span&gt;
&lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;L&amp;quot;%s&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Redirect to another stream:&lt;/span&gt;
&lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;wcerr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Now by default all output goes to std::wcerr&lt;/span&gt;
&lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;%s&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;~~~&lt;/p&gt;
&lt;p&gt;Narrow and wide character types, strings and streams can be freely mixed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The format can be a &lt;code&gt;char&lt;/code&gt; or a &lt;code&gt;wchar_t&lt;/code&gt; character string constant&lt;br /&gt;
  or a &lt;code&gt;string&lt;/code&gt; or &lt;code&gt;wstring&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Independently, the output stream can be a narrow or a wide character&lt;br /&gt;
  stream, and the string assigned from the result can be a narrow or a&lt;br /&gt;
  wide string.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="redirect-default-output-stream-wzxhzdk16wzxhzdk17"&gt;Redirect default output stream &lt;a name="Redirect"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If xprintf() is called with only a stream argument like above in&lt;br /&gt;
xprintf(std::wcerr), this stream becomes the default stream instead of&lt;br /&gt;
the standard output.&lt;/p&gt;
&lt;h2 id="xprintfstream-format-args-wzxhzdk18wzxhzdk19"&gt;xprintf(stream, format, args...) &lt;a name="xprintf_stream_format_args"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;An output stream can be passed to xprintf() as the first&lt;br /&gt;
argument. Then the output is sent to this stream, and xprintf()&lt;br /&gt;
returns the number of characters formatted (which may differ from the&lt;br /&gt;
number of bytes written if e.g. the format is a wide character format&lt;br /&gt;
and the stream a narrow char stream).&lt;/p&gt;
&lt;p&gt;~~~{.cpp}&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="c1"&gt;// Write to stream:&lt;/span&gt;
&lt;span class="k"&gt;int&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;cout&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;%d: %f&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;5.7&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;// Or to wide stream:&lt;/span&gt;
&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;wcerr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;%d: %f&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;5.7&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;~~~&lt;/p&gt;
&lt;p&gt;If the header "xprintf/xprintf_file" has been included, xprintf()&lt;br /&gt;
works identically with FILE* streams like &lt;code&gt;stdout&lt;/code&gt; and &lt;code&gt;stderr&lt;/code&gt;.  This&lt;br /&gt;
call is equivalent to the standard C function fprintf().&lt;/p&gt;
&lt;h2 id="sxprintfformat-args-wzxhzdk20wzxhzdk21"&gt;sxprintf(format, args...) &lt;a name="sxprintf_format_args"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;While the result of xprintf() can be assigned to a &lt;code&gt;string&lt;/code&gt; or a&lt;br /&gt;
&lt;code&gt;wstring&lt;/code&gt;, it isn't one. To pass the result to a function as a string&lt;br /&gt;
argument, the conversion might need to be done by an explicit call to&lt;br /&gt;
the &lt;code&gt;string&lt;/code&gt; constructor.&lt;/p&gt;
&lt;p&gt;The function sxprintf(format, args...) returns a string directly. The&lt;br /&gt;
default string type (&lt;code&gt;string&lt;/code&gt; or &lt;code&gt;wstring&lt;/code&gt;) is determined by the width&lt;br /&gt;
of the &lt;code&gt;format&lt;/code&gt; argument. It can be overridden by a template argument.&lt;/p&gt;
&lt;p&gt;~~~{.cpp}&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="c1"&gt;// Convert result of xprintf(format, args...) to a string&lt;/span&gt;
&lt;span class="n"&gt;my_fun&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="k"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;xprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Result is %d&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;42&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;span class="c1"&gt;// Simpler: use sxprintf(format, args...)&lt;/span&gt;
&lt;span class="n"&gt;my_fun&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sxprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Result is %d&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;42&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Pass wstring to my_fun(), using template argument&lt;/span&gt;
&lt;span class="n"&gt;my_fun&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sxprintf&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;wchar_t&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Result is %d&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;42&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;// Equivalent: use wchar_t format&lt;/span&gt;
&lt;span class="n"&gt;my_fun&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sxprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;L&amp;quot;Result is %d&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;42&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;~~~&lt;/p&gt;
&lt;p&gt;Using &lt;code&gt;sxprintf(format, args...)&lt;/code&gt; should in theory be a little bit&lt;br /&gt;
faster than the otherwise equivalent form `std::string(xprintf(format,&lt;br /&gt;
args...)) since no proxy has to be created.&lt;/p&gt;
&lt;h2 id="creating-a-library-wzxhzdk22wzxhzdk23"&gt;Creating a Library &lt;a name="Library"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Xprintf is preconfigured for header-only use.  This means: Just&lt;br /&gt;
include the proper header and you are done.  In order to reduce space&lt;br /&gt;
overhead and compilation time, a precompiled library can be used.&lt;/p&gt;
&lt;p&gt;The main advantage in using a library is that each time the xprintf&lt;br /&gt;
header is included, the compiler need not look at the implementation&lt;br /&gt;
details.  This can speed up compilation significantly.&lt;/p&gt;
&lt;p&gt;To create the library, the C++ source files &lt;code&gt;libxprintf.cpp&lt;/code&gt; and&lt;br /&gt;
&lt;code&gt;libxprintf_file.cpp&lt;/code&gt; in directory &lt;code&gt;lib&lt;/code&gt; of the distribution must be&lt;br /&gt;
compiled.  Under Linux, just run &lt;code&gt;make&lt;/code&gt;.  Before compiling, you may&lt;br /&gt;
want to select the compiler to use: Uncomment to proper &lt;em&gt;CXX=&lt;/em&gt; - line&lt;br /&gt;
in the toplevel Makefile.template.  Running &lt;code&gt;make&lt;/code&gt; should create a&lt;br /&gt;
library &lt;code&gt;lib/libxprintf.a&lt;/code&gt;, which has to be linked to the programs.&lt;/p&gt;
&lt;p&gt;In Visual C++, instead of building a library, you may just add the&lt;br /&gt;
library source files to your project.&lt;/p&gt;
&lt;p&gt;In order to make the header use the library, you must open the header&lt;br /&gt;
&lt;code&gt;xprintf/xprintf.h&lt;/code&gt; with an editor and change the preprocessor symbol&lt;br /&gt;
&lt;code&gt;XPRINTF_IMPL_USE_LIBRARY&lt;/code&gt; from 0 to 1.  The next time a program is&lt;br /&gt;
compiled, the library will be used.  You can check that the library is&lt;br /&gt;
used as intended by omitting the library when linking.  Linking should&lt;br /&gt;
fail with missing externals.&lt;/p&gt;
&lt;p&gt;In order to run the tests, the headers for the &lt;em&gt;boost&lt;/em&gt; test framework&lt;br /&gt;
are required.&lt;/p&gt;
&lt;h2 id="compatibility-wzxhzdk24wzxhzdk25"&gt;Compatibility &lt;a name="Compatibility"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;All portable standard C printf() formats are supported and should&lt;br /&gt;
yield the identical result as with the standard C printf().&lt;/p&gt;
&lt;p&gt;Most Posix printf() extensions like positional arguments are supported.&lt;/p&gt;
&lt;p&gt;The following additional format declarators are supported:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;%B&lt;/code&gt; formats boolean values, flag &lt;code&gt;#&lt;/code&gt; disables boolalpha&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;%m&lt;/code&gt; formats monetary values, flag &lt;code&gt;#&lt;/code&gt; shows currency sign&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;%M&lt;/code&gt; formats monetary values, flag &lt;code&gt;#&lt;/code&gt; shows international currency name&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The char type used internally for formatting is determined by the&lt;br /&gt;
format char type.  The result should not be affected (besides the&lt;br /&gt;
character count returned).  Wide and narrow format strings, output&lt;br /&gt;
streams, strings and arguments can be freely mixed. Arguments are&lt;br /&gt;
converted to the format char type as needed, and the result is&lt;br /&gt;
converted to proper stream or string type used.&lt;/p&gt;
&lt;p&gt;Xprintf() has been tested with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GCC 4.7, 4.8 and 4.9 on Linux&lt;/li&gt;
&lt;li&gt;Visual Studio Express 2013 for Windows Desktop with November 2013 CTP&lt;/li&gt;
&lt;li&gt;Intel C++ 14.0.2 on Linux&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="format-string-conversion-specifications-wzxhzdk26wzxhzdk27"&gt;Format String, Conversion Specifications  &lt;a name="Format"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Xprintf writes output to a (wide or narrow) output stream under&lt;br /&gt;
control of a (wide or narrow) &lt;code&gt;format&lt;/code&gt; string that specifies how the&lt;br /&gt;
remaining arguments are converted.  If there are insufficient&lt;br /&gt;
arguments for the format, the program is terminated through a call to&lt;br /&gt;
&lt;code&gt;assert()&lt;/code&gt; describing the problematic format string.&lt;/p&gt;
&lt;p&gt;Characters other than &lt;code&gt;%&lt;/code&gt; in the input stream are copied unchanged to&lt;br /&gt;
the output stream.&lt;/p&gt;
&lt;p&gt;The character &lt;code&gt;%&lt;/code&gt; begins a conversion specification.  A conversion&lt;br /&gt;
specification consists of the following parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;An optional &lt;em&gt;argument number specifier&lt;/em&gt; in the form &lt;code&gt;n$&lt;/code&gt;, with &lt;code&gt;n&lt;/code&gt; a&lt;br /&gt;
  decimal integer number denoting the index (after the format string)&lt;br /&gt;
  of the argument to be formatted.  If the argument number specifier&lt;br /&gt;
  is missing, the next consecutive argument is formatted.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Zero or more optional &lt;em&gt;flags&lt;/em&gt; in the form of the characters &lt;code&gt;-&lt;/code&gt;,&lt;br /&gt;
&lt;code&gt;+&lt;/code&gt;, &lt;em&gt;space&lt;/em&gt;, &lt;code&gt;#&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;'&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An optional &lt;em&gt;minimum field width&lt;/em&gt; in the form of a decimal number,&lt;br /&gt;
  an asterisk &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;*n$&lt;/code&gt; with &lt;code&gt;n&lt;/code&gt; a decimal integer number denoting&lt;br /&gt;
  an argument index (see below).  If the converted value requires less&lt;br /&gt;
  width than the specified number of &lt;em&gt;space&lt;/em&gt; characters, it is padded&lt;br /&gt;
  with &lt;em&gt;space&lt;/em&gt; characters on the left side (by default) or on the&lt;br /&gt;
  right side if the left adjustment flag &lt;code&gt;-&lt;/code&gt; has been specified.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An optional &lt;em&gt;precision&lt;/em&gt; in the form of a period &lt;code&gt;.&lt;/code&gt; followed by an&lt;br /&gt;
  decimal number, an asterisk &lt;code&gt;*&lt;/code&gt; or &lt;code&gt;*n$&lt;/code&gt; with &lt;code&gt;n&lt;/code&gt; a decimal integer&lt;br /&gt;
  number (see below).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;An optional &lt;em&gt;argument size modifier&lt;/em&gt; in the form &lt;code&gt;hh&lt;/code&gt;, &lt;code&gt;h&lt;/code&gt;, &lt;code&gt;l&lt;/code&gt;,&lt;br /&gt;
&lt;code&gt;ll&lt;/code&gt;, &lt;code&gt;j&lt;/code&gt;, &lt;code&gt;z&lt;/code&gt;, &lt;code&gt;t&lt;/code&gt; or &lt;code&gt;L&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;A final conversion specifier that specifies the type of the conversion to&lt;br /&gt;
  be applied.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As noted above, the &lt;em&gt;field width&lt;/em&gt; and the &lt;em&gt;precision&lt;/em&gt; may be indicated&lt;br /&gt;
by an asterisk &lt;code&gt;*&lt;/code&gt;, in which case the next argument in sequence&lt;br /&gt;
(before the value to be converted) must contain an integral number&lt;br /&gt;
specifying the value.  A negative field width implies a &lt;code&gt;-&lt;/code&gt; flag.  If&lt;br /&gt;
the form &lt;code&gt;*n$&lt;/code&gt; is used, the decimal integer &lt;code&gt;n&lt;/code&gt; gives the index of the&lt;br /&gt;
argument (after the format) containing the width or precision.&lt;/p&gt;
&lt;p&gt;The &lt;em&gt;flags&lt;/em&gt; and their meanings are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;-&lt;/code&gt; Left-justify the result of the conversion.  If this flag is&lt;br /&gt;
  not specified, the conversion is right-justified.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;+&lt;/code&gt; Format a positive value with a &lt;code&gt;+&lt;/code&gt; sign.  If this flag is not&lt;br /&gt;
  specified, the sign is omitted for positive values.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;space&lt;/em&gt; For a positive value, output a &lt;em&gt;space&lt;/em&gt; at the place of the&lt;br /&gt;
   sign.  If the &lt;em&gt;space&lt;/em&gt; and &lt;code&gt;+&lt;/code&gt; flags both appear, the &lt;code&gt;space&lt;/code&gt; flag&lt;br /&gt;
   is ignored.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;#&lt;/code&gt; The result is converted in an alternative form. For &lt;code&gt;o&lt;/code&gt;, &lt;code&gt;x&lt;/code&gt; and&lt;br /&gt;
&lt;code&gt;X&lt;/code&gt; conversion specifiers, the number is prefixed by &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;0x&lt;/code&gt; or&lt;br /&gt;
&lt;code&gt;0X&lt;/code&gt;.  For &lt;code&gt;f&lt;/code&gt;, &lt;code&gt;F&lt;/code&gt;, &lt;code&gt;e&lt;/code&gt;, &lt;code&gt;E&lt;/code&gt;, &lt;code&gt;g&lt;/code&gt;, &lt;code&gt;G&lt;/code&gt;, &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;A&lt;/code&gt; conversion, the&lt;br /&gt;
  result is always formatted with a decimal point character, even if&lt;br /&gt;
  no digits follow it.  For &lt;code&gt;g&lt;/code&gt; and &lt;code&gt;G&lt;/code&gt; conversions, trailing zeros&lt;br /&gt;
  are not removed from the result.  For the bool conversion specifier&lt;br /&gt;
&lt;code&gt;B&lt;/code&gt;, write &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;1&lt;/code&gt; instead of &lt;code&gt;false&lt;/code&gt; and &lt;code&gt;true&lt;/code&gt;.  For the&lt;br /&gt;
  monetary conversion specifiers, write the currency symbol.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;0&lt;/code&gt; Use leading zeros to pad to the field width instead of spaces.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;'&lt;/code&gt; Insert thousands separators.  This flag is accepted for&lt;br /&gt;
  compatibility with the X/Open printf() specification but ignored by&lt;br /&gt;
  xprintf().  Insertion of thousands separators is dependent on the&lt;br /&gt;
  locale.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The argument size modifiers denote that the argument to be formatted&lt;br /&gt;
is a (signed or unsigned) &lt;em&gt;char&lt;/em&gt; for &lt;code&gt;hh&lt;/code&gt;, &lt;em&gt;short&lt;/em&gt; for &lt;code&gt;h&lt;/code&gt;, &lt;em&gt;long&lt;/em&gt; for&lt;br /&gt;
&lt;code&gt;l&lt;/code&gt;, &lt;em&gt;long long&lt;/em&gt; for &lt;code&gt;ll&lt;/code&gt;, &lt;em&gt;intmax_t&lt;/em&gt; for &lt;code&gt;j&lt;/code&gt;, &lt;em&gt;size_t&lt;/em&gt; for &lt;code&gt;z&lt;/code&gt;,&lt;br /&gt;
&lt;em&gt;ptrdiff_t&lt;/em&gt; for &lt;code&gt;t&lt;/code&gt; or &lt;em&gt;long double&lt;/em&gt; for &lt;code&gt;L&lt;/code&gt;.  They are supported for&lt;br /&gt;
compatibility with the C version of printf() but mostly ignored by&lt;br /&gt;
xprintf(). Xprintf() gets this information from the type of the&lt;br /&gt;
arguments.  The &lt;code&gt;h&lt;/code&gt; and &lt;code&gt;hh&lt;/code&gt; argument size specifiers are used with&lt;br /&gt;
the conversions specifiers &lt;code&gt;o&lt;/code&gt;, &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;X&lt;/code&gt; to mask leading bits from&lt;br /&gt;
signed numbers.  The &lt;code&gt;l&lt;/code&gt; argument size specifier is used with&lt;br /&gt;
conversion specifier &lt;code&gt;c&lt;/code&gt; to convert a wide character.&lt;/p&gt;
&lt;p&gt;The conversion specifiers and their meanings are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;d&lt;/code&gt;, &lt;code&gt;i&lt;/code&gt;, &lt;code&gt;u&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format the argument as a decimal integer.  These conversion&lt;br /&gt;
  specifiers are equivalent, signedness is determined from the type of&lt;br /&gt;
  the argument.  The argument must be of a signed or unsigned integral&lt;br /&gt;
  or a floating point type.  The precision specifies the minimum&lt;br /&gt;
  number of digits.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;o&lt;/code&gt;, &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;X&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format the argument as a octal or hexadecimal number.  Specifier &lt;code&gt;X&lt;/code&gt;&lt;br /&gt;
  uses uppercase hexadecimal letters.  The argument must be of a&lt;br /&gt;
  signed or unsigned integral type, a floating point type or a pointer&lt;br /&gt;
  type.  The precision specifies the minimum number of digits.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;f&lt;/code&gt;, &lt;code&gt;F&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format the argument in plain floating point style &lt;span&gt;[-]&lt;/span&gt;dddd.ddd.  The&lt;br /&gt;
  precision specifies the number of digits to the right of the decimal&lt;br /&gt;
  point and defaults to 6.  The argument must be of a floating point&lt;br /&gt;
  type or a signed or unsigned integral type.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;e&lt;/code&gt;, &lt;code&gt;E&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format the argument in scientific floating point style&lt;br /&gt;
&lt;span&gt;[-]&lt;/span&gt;d.dddddde&lt;span&gt;[+/-]&lt;/span&gt;dd.  The precision specifies the number of digits&lt;br /&gt;
  to the right of the decimal point and defaults to 6.  The argument&lt;br /&gt;
  must be of a floating point type or a signed or unsigned integral&lt;br /&gt;
  type.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;g&lt;/code&gt;, &lt;code&gt;G&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format like the &lt;code&gt;e&lt;/code&gt; or &lt;code&gt;E&lt;/code&gt; specifier if the exponent is less than -4&lt;br /&gt;
  or greater than or equal to the precision, else format like the &lt;code&gt;f&lt;/code&gt; or&lt;br /&gt;
&lt;code&gt;F&lt;/code&gt; specifier.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;a&lt;/code&gt;, &lt;code&gt;A&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format the argument in hexadecimal floating point style&lt;br /&gt;
&lt;span&gt;[-]&lt;/span&gt;0xh.hhhhhhp&lt;span&gt;[+/-]&lt;/span&gt;d.  The precision specifies the number of digits&lt;br /&gt;
  to the right of the decimal point and defaults to the number of&lt;br /&gt;
  digits necessary to exactly represent the argument.  The argument&lt;br /&gt;
  must be of a floating point type or a signed or unsigned integral&lt;br /&gt;
  type.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;c&lt;/code&gt;, &lt;code&gt;C&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Convert to a single character.  If &lt;code&gt;C&lt;/code&gt; is used or the argument size&lt;br /&gt;
  specifier &lt;code&gt;l&lt;/code&gt; is present, the argument is interpreted as a wide&lt;br /&gt;
  character.  Else the argument is truncated to &lt;code&gt;char&lt;/code&gt;.  The argument&lt;br /&gt;
  must be of a signed or unsigned integral type.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;s&lt;/code&gt;, &lt;code&gt;S&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format the argument as a string of characters.  The argument must be&lt;br /&gt;
  a C++ string type (&lt;code&gt;std::string&lt;/code&gt;, &lt;code&gt;std::wstring&lt;/code&gt;,&lt;br /&gt;
&lt;code&gt;std::basic_string&amp;lt;char16_t&amp;gt;&lt;/code&gt; or &lt;code&gt;std::basic_string&amp;lt;char32_t&amp;gt;&lt;/code&gt;) or a&lt;br /&gt;
  C style null-terminated &lt;code&gt;char&lt;/code&gt;, &lt;code&gt;wchar_t&lt;/code&gt;, &lt;code&gt;char16_t&lt;/code&gt; or &lt;code&gt;char32_t&lt;/code&gt;&lt;br /&gt;
  character pointer string.  For the C++ string types, the precision&lt;br /&gt;
  specifies the maximum number of Unicode characters to output.  For&lt;br /&gt;
  the C style null-terminated character pointer string types, the&lt;br /&gt;
  precision specifies the maximum length of the string; if no&lt;br /&gt;
  null-character is found after this number of source characters,&lt;br /&gt;
&lt;code&gt;precision&lt;/code&gt; source characters are output.  For padding, the width of&lt;br /&gt;
  the formatted string is estimated from the Unicode characters using&lt;br /&gt;
  Markus Kuhn's mk_wcswidth().&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;p&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format the argument in an implementation-defined pointer format.&lt;br /&gt;
  The argument must be a pointer or a signed or unsigned integral&lt;br /&gt;
  type.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;B&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format the argument as a &lt;code&gt;bool&lt;/code&gt;.  The argument must be a bool, a&lt;br /&gt;
  signed or unsigned integral type, a floating point type or a pointer&lt;br /&gt;
  type.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;m&lt;/code&gt;, &lt;code&gt;M&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Format the argument as a locale-dependent monetary value.&lt;br /&gt;
  Declarator &lt;code&gt;M&lt;/code&gt; uses the international currency symbol.  Note that in&lt;br /&gt;
  order to write the currency symbol, flag &lt;code&gt;#&lt;/code&gt; must be specified.&lt;br /&gt;
  The argument must by a signed or unsigned integral type or a&lt;br /&gt;
  floating point type.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;n&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Do not output the argument but write the number of characters&lt;br /&gt;
  converted up to this point to the argument.  The argument must be a&lt;br /&gt;
  pointer to a signed or unsigned integral value.&lt;/p&gt;
&lt;p&gt;If the argument type is not usable with the conversion specificator,&lt;br /&gt;
the program is terminated through a call to &lt;code&gt;assert()&lt;/code&gt; describing the&lt;br /&gt;
problematic format string.&lt;/p&gt;
&lt;h2 id="problems-incompatibilities-and-bugs-wzxhzdk28wzxhzdk29"&gt;Problems, Incompatibilities and Bugs &lt;a name="Incompatibilities"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The most likely problem may be that for the "%s" and "%S" formats&lt;br /&gt;
  with a pointer argument, the type of the pointer argument is&lt;br /&gt;
  respected.  With C printf(), the actual type of the pointer argument&lt;br /&gt;
  is ignored, and the format string determines whether it is&lt;br /&gt;
  interpreted as a &lt;code&gt;char*&lt;/code&gt; or a &lt;code&gt;wchar_t*&lt;/code&gt;.  Xprintf interprets the&lt;br /&gt;
  argument diffently based on whether it is passed a &lt;code&gt;char*&lt;/code&gt;, a&lt;br /&gt;
&lt;code&gt;wchar_t*&lt;/code&gt;, a &lt;code&gt;char16_t*&lt;/code&gt; or a &lt;code&gt;char32_t*&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Xprintf does not support the Posix flag &lt;code&gt;'&lt;/code&gt;, which means to format&lt;br /&gt;
  using thousands separators.  With C++, this is dependent on the&lt;br /&gt;
  locale used and can not be switched on or off case by case.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;With the &lt;code&gt;%s&lt;/code&gt; format, the handling of precision and width in format&lt;br /&gt;
  specifiers differs from that by C printf(). The C printf() function&lt;br /&gt;
  counts bytes. This means, blanks are added for a specified width&lt;br /&gt;
  until the specified number of bytes is reached.  If the string&lt;br /&gt;
  contains multibyte characters, and is then printed in a fixed-size&lt;br /&gt;
  font, that can result in misaligned output.  Xprintf pads to the&lt;br /&gt;
  specified width of the Unicode string.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Even worse, if a precision is specified, the C printf() function&lt;br /&gt;
  chops at the specified number of bytes, whithout regard to multibyte&lt;br /&gt;
  character bounds.  Xprintf truncates to the specified number of&lt;br /&gt;
  Unicode characters if the argument is one of the C++ string types&lt;br /&gt;
  like &lt;code&gt;std::string&lt;/code&gt; or &lt;code&gt;std::wstring&lt;/code&gt;.  An exception is output from C&lt;br /&gt;
  style null-terminated string pointers (&lt;code&gt;char*&lt;/code&gt;, &lt;code&gt;wchar_t*&lt;/code&gt; etc.):&lt;br /&gt;
  Since these are possibly used to output from raw memory, the&lt;br /&gt;
  precision is here interpreted as the specified number of source&lt;br /&gt;
  characters.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Format declarators &lt;code&gt;%d&lt;/code&gt; and &lt;code&gt;%u&lt;/code&gt; are interpreted by xprintf() in&lt;br /&gt;
  the identical way. The type of the argument is not converted to&lt;br /&gt;
  signed or unsigned type.  If the argument is a floating point&lt;br /&gt;
  number, the floating point number is formatted in integral format.&lt;br /&gt;
  In each case, the value of the argument, whether signed or unsigned,&lt;br /&gt;
  is preserved and correctly represented in the output.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="bugs"&gt;Bugs&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The standard I/O functions in header xprintf/xprintf_std.h are not&lt;br /&gt;
  selected by the function overload resolution if only the format&lt;br /&gt;
  string and no further arguments are specified.  In this case&lt;br /&gt;
  argument dependent lookup selects the standard functions in&lt;br /&gt;
  namespace &lt;code&gt;::&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="license-wzxhzdk30wzxhzdk31"&gt;License &lt;a name="License"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Copyright (c) 2014 Ruediger Helsch; All rights reserved&lt;/p&gt;
&lt;p&gt;Permission to use, copy, modify, and distribute this software for any&lt;br /&gt;
purpose and without fee is hereby granted.  The author disclaims all&lt;br /&gt;
warranties with regard to this software.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ruediger Helsch</dc:creator><pubDate>Sun, 29 Jun 2014 21:10:22 -0000</pubDate><guid>https://sourceforge.netb55f96f6fae08aace1b4bbeafd4f9a8b7076a13a</guid></item></channel></rss>