我将 CLIPS 嵌入到 C 语言中。并有代码:
main{
DATA_OBJECT factlist;
int end,i;
void *multifieldPtr;
char *tempPtr;
InitializeEnvironment();
Load("constructs.clp");
Reset();
GetFactList(&factlist,NULL);//send facts from clips to c application.
end=GetDOEnd(factlist);
printf("end=%d\n",end);
printf("Lengthis%d\n",GetDOLength(factlist));
multifieldPtr=GetValue(factlist);
printf("%d\n",end);
for (i = GetDOBegin(factlist); i <= end; i++){
printf("i=%d\n",i);
if (GetMFType(multifieldPtr,i) == FACT_ADDRESS){
tempPtr = ValueToString(GetMFValue(multifieldPtr,i));//have problems here
printf("%d\n",*tempPtr);//have problems here
}
else{printf("%d\n",GetMFType(multifieldPtr,i));
}
}
}
我知道 GetMFType(muntifieldPtr,i) 返回 FACT_ADDRESS,我想知道如何从 FACT_ADDRESS 中获取代表事实值的字符串值并将事实打印到屏幕上