Prints formatted data to stdout.
#include <stdio.h> int printf(const char *format[, argument] ...); int printf_s(const char *format[,argument] ...); #include <wchar.h> int wprintf(const wchar_t *format[, argument] ...); int wprintf_s(const wchar_t *format[, argument] ...);
format
argument
The ordinary characters and escape sequences are copied to stdout in order of their appearance. For example, the line:
printf("Line one\n\t\tLine two\n");
produces the output:
Line one Line two
Format specifications always begin with a percent sign (%) and are read left to right. When printf encounters the first format specification, it converts and outputs the value of the first argument after format. The second format specification causes printf to convert and output the second argument, and so on. If there are more arguments than format specifications, printf ignores the extra arguments. The results are undefined if there are fewer arguments than format specifications.
wprintf
is a wide-character version of printf
; format
is a wide-character string. wprintf
and printf
behave identically if the stream is opened in ANSI mode. printf
does not currently support output into a UNICODE stream.
printf_s
and wprintf_s
perform parameter validation. If format
is NULL then the function returns -1 and errno
is set to EINVAL.
tchar.h routine |
_UNICODE not defined |
_UNICODE defined |
---|---|---|
_tprintf | printf | wprintf |
_tprintf_s | printf_s | wprintf_s |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 INtime 6.0 (for wide-character and generic-text versions) |
intime/rt/include/stdio.h intime/rt/include/wchar.h intime/rt/include/tchar.h |
stdio.h wchar.h tchar.h |
clib.lib |