Example 7



   * CmdReturn *Demo_GetCmd ()--

   * Demonstrates retrieving a value from a hash table.

   * Returns the value of the requested item in the hash table


   * Arguments

   * objv[0]: "demo"

   * objv[1]: "get"

   * objv[2]: hash Key


   * Results

   * No changes to hash table. Returns saved value, or sets error.


   * Side Effects:

   * None


   CmdReturn *Demo_GetCmd (ClientData info,

          Tcl_Interp *interp,

          int objc,

          Tcl_Obj *objv[]) {

    Tcl_HashEntry *hashEntryPtr;

    CmdReturn *returnStructPtr;

    char *returnCharPtr;

    Tcl_Obj *returnObjPtr; ...

Get Tcl/Tk, 3rd Edition now with O’Reilly online learning.

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