RtWprintf
RtWprintf prints formatted output to the standard output stream or console window.
Syntax
INT RtWprintf( const WCHAR *fmt [, argument, . . .] );
Parameters
lpFormat
The format control with optional arguments.
Return Value
The number of wide characters printed, if the function succeeds, a negative value if the function fails
Remarks
RtWprintf is similar to wprintf, but RtWprintf does not require the Microsoft C Runtime library and can work with any combination of run-time libraries.
NOTE: This function does not support floating point conversions in the RTSS environment.
RtWprintf behaves differently in RTSS and Windows environments when given an invalid address:
- In the RTSS environment, RtWprintf displays an error message: RtWprintf failed: invalid parameter or format string provided.
- In the Windows environment, an invalid address results in an Access Violation error.
RtWprintf formats and prints a series of characters and values to the standard output stream, stdout, or to the RTX64 Console, depending on the application type:
- In RTSS applications RtPrintf/RtWprintf only write to the RTX64 Console (never to stdout). If you redirect stdout to a file with freopen, RtPrintf/RtWprintf will continue to write to the RTX64 console, but printf/wprintf (and their related APIs) will write to the file.
- In Windows applications, RtPrintf/RtWPrintf only write to stdout (never to the RTX64 Console). If you redirect stdout to a file with freopen, RtPrintf/RtWprintf will write to the file (because stdout was redirected).
If arguments follow the format string, the format string must contain specifications that determine the output format for the arguments.
The format argument consists of ordinary characters, escape sequences, and (if arguments follow format) format specifications. The ordinary characters and escape sequences are copied in order of their appearance.
Format specifications always begin with a percent sign (%) and are read left to right. When RtWprintf encounters the first format specification (if any), it converts the value of the first argument after format and outputs it accordingly. The second format specification causes the second argument to be converted and output, and so on. If there are more arguments than there are format specifications, the extra arguments are ignored. The results are undefined if there are not enough arguments for all the format specifications.
Example
RtWprintf(L"Line one\n\t\tLine two\n");
produces the output:
Line one Line two
Format Specification Fields
See the format specification fields in the Remarks section of RtPrintf for details.
Requirements
Minimum Supported Version | RTX64 2013 |
Header | Rtapi.h |
Library | RtApi.lib (Windows), Rtx_Rtss.lib (RTSS) |
See Also: