[Previous]
[Contents]
[Next]

vcprintf()

write formatted output directly to the console

Synopsis:

#include <conio.h>
#include <stdarg.h>
int vcprintf( const char *format, va_list arg );

Description:

The vcprintf() function writes output directly to the console under control of the argument format. The putch() function is used to output characters to the console. The format string is described under the description of the printf() function. The vcprintf() function is equivalent to the cprintf() function, with the variable argument list replaced with arg, which has been initialized by the va_start() macro.

Returns:

The number of characters written, or a negative value if an output error occurred. When an error has occurred, errno indicates the type of error detected.

Examples:

#include <conio.h>
#include <stdarg.h>
#include <time.h>

#define ESCAPE 27

void tprintf( int row, int col, char *format, ... )
 {
    va_list arglist;

    cprintf( "%c[%2.2d;%2.2dH", ESCAPE, row, col );
    va_start( arglist, format );
    vcprintf( format, arglist );
    va_end( arglist );
 }

void main()
  {
    struct tm  time_of_day;
    time_t     ltime;
    char       buf[26];

    time( &ltime );
    _localtime( &ltime, &time_of_day );
    tprintf( 12, 1, "Date and time is: %s\n",
        _asctime( &time_of_day, buf ) );
  }

Classification:

WATCOM

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

_bprintf(), cprintf(), fprintf(), printf(), putch(), sprintf(), va_arg(), va_end(), va_start(), _vbprintf(), vfprintf(), vprintf(), vsprintf()


[Previous]
[Contents]
[Next]