Example 7

Demo_GetCmd

   /*------------------------------------------------------------

   * 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.