NWvsprintf
Formats a string and outputs it to standard output (parameter reordering is supported)
#include <time.h> or #define NWL_EXCLUDE_TIME #include <stdio.h> or #define NWL_EXCLUDE_FILE #include <nwlocale.h> N_EXTERN_LIBRARY(nint) NWvsprintf ( pnstr buffer, const nstr N_FAR *format, va_list argList);
uses netwin32 Function NWvsprintf (buffer : pnstr format : const nstr; argList : va_list ) : nint;
Returns the number of bytes output.
The variable argument list is given as a single va_list parameter.
For information about formatting data, see the printf function in any C manual.
The reordering feature allows a language translator to change the order in which arguments are printed by just changing the format string.
There are two ways to do parameter reordering. The most common way is to specify the argument order with a %n in front of each formatting code. For example:
NWprintf("There are %d files in the directory %s.\n", numfiles, dirname);
In an internationalized program, the format string would actually be stored in a separate file to be translated into other languages. The following statement changes the order of the arguments with only a change in the format string:
NWprintf("Directory %2%s contains %1%d files.\n", numfiles, dirname);
The second method allows parameter ordering to be determined at run time. The format string is prepended with a reordering vector specifying the argument order. The reordering vector is a series of bytes with the following format:
LDH!<n><o1><o2><o3>...<format string> <n><o1><o2><o3> etc. are binary bytes.
Where:
<n> is the number of arguments in the printf statements. <o1> specifies which argument should be printed first. If the third argument should be printed first, then <o1> would contain the binary value 3. <o2> specifies which argument should be printed second, etc..