RosettaCodeData/Task/Use-another-language-to-call-a-function/PicoLisp/use-another-language-to-call-a-function-2.l

12 lines
283 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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;
}