_cprintf

Description

Formats and prints to the console.

#include <conio.h> Required only for function declarations  

int _cprintf( char *format [[,argument]] ...);

format Format control string  
argument Optional arguments  

Remarks

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. The format has the same form and function as the format argument for the printf function; see printf for a description of the format and arguments.

Note that unlike the fprintf, printf, and sprintf functions, _cprintf does not translate line-feed characters into carriage-return–line-feed (CR-LF) combinations on output.

Return Value

The _cprintf function returns the number of characters printed.

Compatibility

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:DOS32X

See Also

_cscanf, fprintf, printf, sprintf, vprintf

Example

/* CPRINTF.C: This program displays some variables to the console. */

#include <conio.h>

void main( void )

{

int i = -16, h = 29;

unsigned u = 62511;

char c = 'A';

char s[] = "Test";

/* Note that console output does not translate \n as

* standard output does. Use \r\n instead.

*/

_cprintf( "%d %.4x %u %c %s\r\n", i, h, u, c, s );

}

Output

-16 001d 62511 A Test