Writing Formatted Strings

You can write formatted strings using the video print formatted function, v_printf(). This function provides the equivalent of printf() supplied by your compiler. The format of the call for v_printf() is as follows:

int v_printf(wnp, format_stp, args...)
 
WINDOWPTR wnp;
/* Pointer to window to write to
*/
UCHAR *format_stp
/* Format control string
*/
---- args;
/* List of arguments to be formatted
*/

Refer to printf() in your compiler reference manual for the interpretation of format control string and the argument parameters.

v_printf() temporarily sets the scrolling quantity to AS_NEEDED so that the entire string is written. It respects all other values for the window write option settings.

Caution: A temporary working buffer of VPSTMAXLEN bytes is allocated to hold the formatted string. VPSTMAXLEN is a symbolic constant that is defined to 133. You may change VPSTMAXLEN before compiling (it is located in vv_sys.h). If your formatted string is longer than the buffer, corruption of memory will occur.

Caution: The number of arguments you can pass to v_printf() is limited. The total number of bytes that can be passed is 20 times the size of an unsigned integer on your machine. For example, under DOS an unsigned integer is 2 bytes; therefore, you cannot pass more than 40 bytes of data in the list of arguments.

Caution: Use of this routine will link in sprintf() and all of its underlying routines. This may result in a significantly larger executable file. Also, printing floating point numbers may require that you link in a floating point math library, which will further increase the size of your executable files.


Home Contents Previous Next