Created
November 2, 2010 15:35
-
-
Save iratqq/659783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <ecl/ecl.h> | |
size_t | |
sexp_to_str(char *dest, size_t len, char *fmt, const char *exp) | |
{ | |
cl_object exp_ = c_string_to_object(exp); | |
cl_object fmt_; | |
fmt_ = cl_format(3, Cnil, make_constant_base_string(fmt), exp_); | |
return strlcpy(dest, ecl_base_string_pointer_safe(fmt_), len); | |
} | |
int | |
main(int argc, char *argv[]) | |
{ | |
char buf[256]; | |
cl_boot(argc, argv); | |
sexp_to_str(buf, sizeof(buf), "hello ~a~%", "(1 2 3)"); | |
printf("%s", buf); | |
cl_shutdown(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment