RAD Studio |  |

cprintf

Header File

conio.h

Category

Console I/O Routines

Prototype

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

Description

Writes formatted output to the screen.

cprintf accepts a series of arguments, applies to each a format specifier contained in the format string pointed to by format, and outputs the formatted data directly to the current text window on the screen. There must be the same number of format specifiers as arguments.

For details details on format specifiers, see printf Format Specifiers.

The string is written either directly to screen memory or by way of a BIOS call, depending on the value of the global variable _directvideo.

Unlike fprintf and printf, cprintf does not translate linefeed characters (\n) into carriage-return/linefeed character pairs (\r\n). Tab characters (specified by \t) are not expanded into spaces.

Note: Do not use this function in Win32 GUI applications.
Return Value

cprintf returns the number of characters output.

Example

Copy Code

    #include <conio.h>
    int main(void)
    {
       /* clear the screen */
       clrscr();
       /* create a text window */
       window(10, 10, 80, 25);
       /* output some text in the window */
       cprintf("Hello world\r\n");
       /* wait for a key */
       getch();
       return 0;
    }

Portability

POSIX | Win32 | ANSI C | ANSI C++
| + |  |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!