#include "cobscreen.h" int cobprintf (const cobchar_t *fmt, ...);
fmt | The formatted string to display |
None.
The following code displays a simple counter:
int secs = 10; char *message = "Time Left: "; cobmove(10, 10); cobprintf("%s%d", message, secs); while (secs--) { sleep(1); cobmove(10, 10 + strlen(message)); cobprintf("%2d", secs); }
Comments:
The formatted character string fmt is displayed with the default attribute (A_NORMAL), starting at the current position of the virtual cursor. If the string is longer than the remaining width of the line it wraps when it reaches the edge of the screen.
The fmt parameter is formatted as it would be by the C library routine, printf(). For example, any %s in fmt is substituted for the string in the subsequent arguments passed to cobprintf().
The character \n (new line) is a valid character and moves the virtual cursor to the beginning of the next line. The null character \0 terminates the string. No other control characters are valid; their use causes undefined results.
The specified string must not be longer than 255 characters in length when fmt has been fully expanded.
This routine returns either the number of arguments output or -1 for an error condition.