Listing 2: CounterTcl CABLE configuration
# stdstring.tcl
# Use the stdstring wrapper.
load ./libStringTcl.so
# Create an instance of std::string.
set s0 [stdstring]
# Call the C++ assignment operator to set it.
$s0 = "FooBar"
# Print the string's value:
puts [$s0 c_str]
# Create another instance
set s1 [stdstring "Hello, World!"]
puts [$s1 c_str]
# Find the substring before the first comma.
set s2 [$s1 substr 0 [$s1 find_first_of ,]]
puts [$s2 c_str]
# The output from this script should be:
# FooBar
# Hello, World!
# Hello