TWUDebugPrintf
The TWUDebugPrintf function writes a formatted text string to the debugging log file. This function is only available in the Debug version of the TWU DLLs (TWU32D.dll and TWUNTD.dll).
void TWUDebugPrintf( const TCHAR *pszFormat, ... );
Tip: To make inclusion or exclusion based on the _DEBUG macro easier, you can use the TWULOG macro, which is defined as follows:
#ifdef _DEBUG #define TWULOG(x) TWUDebugPrintf x #else #define TWULOG(x) ((void)0) #endif
You must use this macro with a double set of parentheses, like this:
TWULOG((_T("%s: failed with error %u\n"), pszPath, uResult));
The double parentheses are required to allow the use of a variable number of arguments in the macro expansion, because most C/C++ compilers don't support variadic preprocessor macros.
Parameters
- pszFormat
- [Input] Formatting string; see Formatting specification below for its syntax.
- ...
- Zero or more arguments for the formatting string specified by pszFormat.
Return value
none
Formatting specification
The formatting specification is similar to that used by printf. It consists of a text string that contains literal text interspersed with formatting specifiers. Each formatting specifier starts with a % (percent) sign and must be matched with a corresponding argument to the right of pszFormat (except for the literal percent character inserted by %%). It must use the following syntax:
%[-][#][0][,][width][.precision][size]type
The options must appear in the order shown and have the following meaning. Options within [brackets] are optional.
Option | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
% | Signals the start of a format specification. To insert a literal '%' character, use two in sequence: %% | ||||||||||||||||||||||||
- | Left-align the formatted data within its field width | ||||||||||||||||||||||||
# | Add a prefix or padding: # padding for types a, s, w; # prefix for type p; 0x prefix for x and X types. | ||||||||||||||||||||||||
0 | Zero-pad the data to its field width (overrides # for types a, s, w). If neither # nor 0 is specified, the field is padded with spaces if necessary to achive the minimum width. | ||||||||||||||||||||||||
, | Insert thousands separators for types d, i, and u. The thousands separator follows the locale conventions of the current user. | ||||||||||||||||||||||||
width | Decimal number that specifies the minimum formatted field width. Padding uses 0, #, or spaces, depending on the earlier options. | ||||||||||||||||||||||||
.precision | Decimal number that specifies the maximum formatted width (for types d, i, u, x and X) or the maximum number of characters to copy (for types a, s, w). | ||||||||||||||||||||||||
size | Data size modifier for types d, i, u, x and X; may be one of the following:
|
||||||||||||||||||||||||
type | Data type specifier; may be one of the following:
All other type characters cause TWUDebugPrintf to exit immediately. |