[Ecls-list] Printing to a string

Dean O'Connor dean.oconnor at ite.com.au
Sun Jan 15 20:39:00 UTC 2006


I tried your source in Windows MSVC (see below) and the cl_print works ok.
ie. I see #(1 2 3) displayed on the screen.

However, the ecl_string_pointer_safe line crashes for me.

I guess the cl_print (in this case) will return a object of type vector 
(same as myarray).

Not too sure what you are trying to do with ecl_string_pointer_safe, and 
I can't find any doco on it, but I don't think you need it if you just 
want to print an object to the screen.
Just lose the last line I think ??

The cl_print will print most/all objects to screen AFAIK.


Cheers
Dean.

#include "ecl.h"

int main(int argc, char* argv[])
{
   cl_boot(argc, argv);
   cl_object myarray = c_string_to_object("#(1 2 3)");
   cl_object cl_str = cl_print(1, myarray);
   cl_object str = ecl_string_pointer_safe(cl_str);   // Crashes here 
for me :)

    return 0;
}

David Creelman wrote:

>Hi,
>
>I'm wanting to generically print an atom, symbol, list, string, etc out
>to a string that I can then display on the screen (a la REPL).
>
>I thought cl_print would do this for me, but ECL crashes when I call the
>following:-
>
>	cl_object myarray = c_string_to_object("#(1 2 3)");
>	cl_object cl_str = cl_print(1, myarray);	// This crashes.
>	str = ecl_string_pointer_safe(cl_str);
>
>What am I doing wrong here ?
>
>Can this be done or should I be doing my own interpretation of types ?
>
>Regards
>David
>
>  
>




More information about the ecl-devel mailing list