cprintf() Formatted Write to Console
#include <conio.h>
int cprintf(format-string[,argument...]);
char *format-string; Format control string
cprintf() formats and prints a series of characters and values to the
console. putch() is used to output characters.
The format string and arguments for cprintf() are the same as those
for printf(). See the description of the printf() function for a
detailed explanation of the format string and arguments.
Returns: cprintf() returns the number of characters printed.
Notes: Unlike fprintf(), printf(), and sprintf(), cprintf() does
doesn't translate line-feed characters into carriage-
return-line-feed pairs.
-------------------------------- Example ---------------------------------
The following statements product formatted output of characters,
strings, and integers.
#include <stdio.h>
char *str1 = "This", *str2 = "shows";
char *str3 = "how", *str4 = "to manipulate";
char *str5 = "string", *str6 = "output";
int num1 = 5000, num2 = 6;
double dbl = 5871.115
char c1 = 'x', c2 = 'y', c3 = 'z';
main()
{
cprintf("%d + %d = %d\n",num1,num2,num1+num2);
cprintf("Print the string \"%s\" in the middle of this text.\n",
str6);
cprintf("\n\n");
cprintf("\t%f\t%.3f\t%E\n",dbl,dbl,dbl);
cprintf("%c, %c, %c ",c1,c2,c3);
cprintf("%c, %c, %c \n",c3,c2,c1);
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster