first previous next last contents

w and vw

#include <tcl_utils.h>
char *w(char *str);
char *vw(char *fmt, ...);

These functions return strings held in writable memory. Writable strings are required in the arguments of many Tcl functions, including Tcl_SetVar and Tcl_GetKeyedListField. The arguments specify the string the return as writable. For w() this is simply an exact copy of the argument. For vw() the returned string is a formatted copy of the input, which is specified in the standard printf style.

The return value from the w function isvalid only until the next call of w(). Similarly for the vw function.

Examples of usage are:

Tcl_GetKeyedListField(interp, vw("MODE%d", mode_num), gap_defs, &buf);

Tcl_SetVar(interp, w("arr(element)"), "10", TCL_GLOBAL_ONLY);

NOTE: In the current implementations both functions have a limit of handling 8192 bytes per call.

first previous next last contents
This page is maintained by staden-package. Last generated on 1 March 2001.