[Ecls-list] Printing to a string

Goffioul Michael goffioul at imec.be
Mon Jan 16 00:20:02 UTC 2006


> Hi Dean,
> 
> Thanks.
> 
> Yes, that works for me too, but I'm wanting to put the string 
> from the print up onto a GUI, not standard output. I thought 
> ecl_string_pointer_safe would do that (assuming that cl_print 
> returns a string..).

cl_print does not returns a string, it returns the object printed.
In your case, it returns the array.

> Any idea how I'd get the string back ?

Use cl_format as mentionned in the other mail. However, keep in mind
that ECL string objects are not always null terminated (e.g. adjustable
strings). From experience, I know that cl_format *can* return non
null-terminated string. To convert it to a regular C string, use 
ecl_null_terminated_string() function, which returns a ECL strign object
that is null terminated.

Michael.




More information about the ecl-devel mailing list