Name
cprintf - Formats and prints directly to the console.
Syntax
#include <conio.h>
int cprintf(format-string[, argument...])
char *format-string;
Description
The cprintf function formats and prints a series of
characters and values directly to the console, using the
putch function to output characters. Each argument (if any)
is converted and output according to the corresponding
format specification in format-string. The format-string
has the same form and function as the format-string argument
for the printf function; see the printf reference page for a
description of the format and arguments.
Return Value
The cprintf function returns the number of characters
printed.
See Also
cscanf(DOS), fprintf(S), printf(S), sprintf(S), vprintf(S)
Notes
Unlike the fprintf, printf, and sprintf functions, cprintf
does not translate line-feed (LF) characters into carriage-
return/line-feed combinations (CR-LF) on output.
Example
#include <conio.h>
int i = -16, j = 29; unsigned int k = 511;
main( )
{
cprintf("i=%d, j=%#x, k=%u\r\n",i,j,k);
/* Output: i=-16, j=0x1D, k=511 */
}
This program prints the values of the variables i, j, and k
to the console. The cprintf function is similar to the
printf function except that it sends output to the console.
(printed 6/18/89)