Format
#include <conio.h> int _cprintf(char *format, argument-list);
Language Level: Extension
_cprintf
formats and sends a series of characters and values directly to
the screen, using the _putch function to send each character.
The format string has the same form and function as the format string parameter for printf. Format specifications in the format string determine the output format for any argument-list that follows. See printf -- Print Formatted Characters for a description of the format string.
Note: Unlike the fprintf, printf, and sprintf functions, _cprintf does not translate line feed characters into output of a carriage return followed by a line feed.
Return Value
_cprintf returns the number of characters printed.
Example
The following program uses _cprintf to write
strings to the screen.
#include <conio.h>
int main(void)
{
char buffer[24];
_cprintf("\nPlease enter a filename:\n");
_cscanf("%23s", buffer);
_cprintf("\nThe file name you entered was %23s.", buffer);
return 0;
/************************************************************
The output should be similar to:
Please enter a filename:
file.dat
The filename you entered was file.dat.
************************************************************/
}
![]()
_cscanf -- Read Data from
Keyboard
fprintf -- Write
Formatted Data to a Stream
printf -- Print
Formatted Characters
_putch -- Write
Character to Screen
sprintf -- Print
Formatted Data to Buffer
<conio.h>