I'm sure I must be missing something obvious, but how can I make the second example work properly?Code:#include <stdio.h> #include <process.h> int main() { char p[5] = "less"; /* pager */ char buff[30]; /* this shows test.txt in less */ sprintf(buff, "\"%s\" \"test.txt\"", p); spawnlp(P_WAIT, "less", buff, NULL); /* this does NOT show test.txt in less */ sprintf(buff, "\"%s\", \"%s\" \"test.txt\"", p, p); spawnlp(P_WAIT, buff, NULL); return 0; }
Thanks in advance.