Hi,<br><br>How can I convert a string from lisp to a c string, so that I can use it in C?<br>It seems a FAQ question, but I can not find the answer...<br><br>My current version looks exactly like:<br><br>-------------------C---------------------<br>
int main(int argc, char** argv)<br>{<br>    cl_boot(argc, argv);<br>    cl_load(1, make_base_string_copy("simple.lisp"));<br><br>    for (int i=0; i<220; i++) {              /* 220 is just a random large value for testing, see below */<br>
        cl_object cl_string = cl_funcall(1, cl_intern(1, make_simple_base_string("GET-STRING")));<br>        char*      c_string = ecl_base_string_pointer_safe(cl_string);<br>    }<br>    <br>    cl_shutdown();<br>
}<br><br>--------------------CL: simple.lisp---------------------------<br>(defun get-string ()<br>  (let ((result (format nil "<?xml version='1.0' encoding='UTF-8' standalone='no'?>~%~%<svg xmlns='<a href="http://www.w3.org/2000/svg">http://www.w3.org/2000/svg</a>' version='1.1'>~%  <rect x='0' y='0' width='fixed' height='fixed' style='fill: none' stroke='blue' />~%</svg>~%")))<br>
    (print (format nil "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$~%"))<br>    (print (format nil "~a~%" result))<br>    (print (format nil "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx~%"))<br>    result))<br><br>However when I ran the program, after several correct iterations, I encountered following problem:<br>
<br>--------------------OUTPUT------------------------------<br>Cannot coerce a string with fill pointer to (char *)<br><br>Available restarts:<br><br>1. (QUIT-DEBUGGER) Quit debugger level 1.<br><br>Broken at NIL.<br><br>
So I mean the error occurs after several successful iterations.<br><br>Any ideas?<br>