RosettaCodeData/Task/Use-another-language-to-cal.../PicoLisp/use-another-language-to-cal...

12 lines
283 B
Plaintext

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;
}