T
tntelle
Hello - I have a bit of C code that executes an external script
using popen and reads the last line of output. The problem is I want
to send argugments to the external shell script - which is not a big
deal, the problem is using a variable:
using arguments like this:
FILE * f = popen("./ext.ksh arg1", "r");
size_t r;
while((r = fread(RETURN_CODE, sizeof(char), BUFSIZE - 1, f)) > 0) {
RETURN_CODE[r+1] = '\0';
i want arg1 to be a variable
char arg1[] = "TEST"
FILE * f = popen("./ext.ksh %s", "r");
how do you get this to work ? is it possible or is there an
alternative ?
Thank you in advance!
using popen and reads the last line of output. The problem is I want
to send argugments to the external shell script - which is not a big
deal, the problem is using a variable:
using arguments like this:
FILE * f = popen("./ext.ksh arg1", "r");
size_t r;
while((r = fread(RETURN_CODE, sizeof(char), BUFSIZE - 1, f)) > 0) {
RETURN_CODE[r+1] = '\0';
i want arg1 to be a variable
char arg1[] = "TEST"
FILE * f = popen("./ext.ksh %s", "r");
how do you get this to work ? is it possible or is there an
alternative ?
Thank you in advance!