RosettaCodeData/Task/Use-another-language-to-call-a-function/Perl-6/use-another-language-to-call-a-function-2.pl6
2020-02-17 23:21:07 -08:00

15 lines
336 B
Raku

#include<stdio.h>
#include<stddef.h>
#include<string.h>
int Query(char *Data, size_t *Length) {
FILE *fp;
char buf[64];
sprintf(buf, "/home/user/query.p6 --len=%zu", *Length);
if (!(fp = popen(buf, "r")))
return 0;
fgets(Data, *Length, fp);
*Length = strlen(Data);
return pclose(fp) >= 0 && *Length != 0;
}