Toolkit Tutorial: Advanced Programming


  dt_Handle container ;
 
dt_Integer length ;
 
dt_String string ;
 
char input [ 8192 ];

 
/* put program input as a string or a sequence of strings */
 
object = dt_alloc_string ( strlen ( input ), input );
 
container = dt_converse ( program , object );
 
dt_dealloc ( object );

 
/* get program output as a sequence of strings */
 
object = dt_next ( container );
 
if ( NULL_OB != ( string = dt_stringvalue ( & length , object )))
   
printf ( "%.*s\n" , length , string );
 
dt_dealloc ( object );
 
dt_dealloc ( container );