title: Handling CLIPS C functions' return values as string(s)
body: <p>I'm calling CLIPS Eval() and other functions from my C code and need help understanding how to handle return values that are CLIPSValue or UDFValue. A simple example ...</p>
  <pre><code>...
  CLIPSValue  cv;
  UDFValue    uv;
  EvalError   ee;
  LoadError   le;
  
  entry-&gt;env = CreateEnvironment();
  le = Load(entry-&gt;env, filePathBuffer);
  
  if (le != LE_NO_ERROR)
  {
      // report the load error ...
  }
  
  // Tried this but having trouble handling cv: GetDeftemplateList(entry-&gt;env, &amp;cv, NULL);
  // Trying with Eval ...
  ee = Eval(entry-&gt;env, &quot;(list-deftemplates)&quot;, &amp;cv);
  printf(&quot;%d -- %hi -- %ld -- %s&quot;, ee, cv.multifieldValue-&gt;header.type, cv.multifieldValue-&gt;length, cv.multifieldValue-&gt;lexemeValue-&gt;contents);
  ...
  </code></pre>
  <p>... the above printf is broken because I'm not correctly understanding cv structure/union.</p>
  <p>Also looking into using DataObjectToString(...) but can't see how to convert CLIPSValue to UDFValue which DataObjectToString(...) needs as input.</p>
  <p>Further processing of the result is needed, so using something like WriteCLIPSValue(...) isn't sufficient.</p>
  <p>Would it be possible to use a router other than STDOUT with WriteCLIPSValue(...) and similar functions to only <strong>format</strong> response strings sort of like sprintf(...)?</p>
  <p>I'm open to whatever approach is best but prefer simple/minimal C code.</p>