Re: asserta/retract via C++
Lindsey Spratt <[email protected]>
| Newsgroups | gmane.comp.gnu.prolog.general |
|---|---|
| Message-ID | <[email protected]> |
Your problem is indeed your use of Mk_String.
Instead of
arg[0] = Mk_String("lives(elvis)");
use
PlTerm termArgs[1];
termArgs[0] = Mk_String("elvis");
int clauseFunc = CreateAllocateAtom("lives");
arg[0] = Mk_Compound(clauseFunc, 1, termArgs);
I haven't tried this piece of code, so there may well bugs, but
perhaps you get the idea: build a compound term.
Lindsey
On Jul 19, 2008, at 11:34 AM, aLu wrote:
>
> Basically my code looks like this:
>
> PlTerm arg[10];
> int func = Find_Atom(asserta);
> arg[0] = Mk_String("lives(elvis)");
>
> Pl_Query_Begin(TRUE);
> Pl_Query_Call(func, 1, arg);
>
>
> //If the same program calls something like this (in another function):
>
> int func = Find_Atom(listing);
> Pl_Query_Begin(TRUE);
> Pl_Query_Call(func, 0, arg2);
>
>
> ///
>
>
>
>
> It prints something like this out to the console:
>
> number1(abc,cba). // these are dynamic
> predicates
> number1(cga,bae).
> number2(get,gea).
>
> 'lives(elvis)'. // those brackets are my
> problem!
>
> someotherpredicate(gla,era).
>
>
> So how can I avoid that my predicate appears in brackets?
> Is it about Mk_String? Mk_Atom(Create_Atom("lives(elvis)"))
> gives the same result.
>
> Thanks for reading
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Users-prolog mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/users-prolog