34. Accessing Tcl Variables

In this chapter we cover how to set Tcl variables from C, how to read their values, and how to delete them. We also describe how to link C variables and Tcl variables, so that when one changes, the other changes as well. Also included is a description of variable traces.

34.1 Functions Presented in This Chapter

This chapter covers the following functions for manipulating Tcl variables from C code:

Tcl_Obj *Tcl_SetVar2Ex(Tcl_Interp *interp,                CONST char *name1, CONST char *name2,                Tcl_Obj *newValuePtr, int flags)

Sets the variable given by name1 (and name2 in the case of an array element) to newValuePtr.

CONST char *Tcl_SetVar(Tcl_Interp *interp,                CONST char *varName, CONST ...

Get Tcl and the Tk Toolkit, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.