RosettaCodeData/Task/Use-another-language-to-call-a-function/PicoLisp/use-another-language-to-call-a-function-2.l
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

11 lines
283 B
Text

int Query(char *Data, size_t *Length) {
FILE *fp;
char buf[64];
sprintf(buf, "/usr/bin/picolisp query.l %d -bye", *Length);
if (!(fp = popen(buf, "r")))
return 0;
fgets(Data, *Length, fp);
*Length = strlen(Data);
return pclose(fp) >= 0 && *Length != 0;
}