Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>cprintf() formatted write to console</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 cprintf()               Formatted Write to Console

 #include <conio.h>

 int        cprintf(format-string[,argument...]);
 char       *format-string;              Format control string

    cprintf() formats a series of characters and values and prints them
    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()
                doesn't translate line-feed characters into carriage-
                return-line-feed pairs.

 Portability:   Applies to MS DOS only.

   -------------------------------- Example ---------------------------------

    The following statements produce 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("\r\n\r\n");
           cprintf("\t%f\t%.3f\t%E\r\n",dbl,dbl,dbl);
           cprintf("%c, %c, %c    ",c1,c2,c3);
           cprintf("%c, %c, %c \r\n",c3,c2,c1);
           }



See Also: fprintf() printf() sprintf() vprintf()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson