In my c progr开发者_StackOverflow社区am, I want to launch a script by popen().
like this: char mimetype[256];
//give mimetype a value
popen("xdg-mime query default some-mime-type", "r");
Is it possible to pass "some-mime-type" as an argument from c program to the bash command?
Great thanks!
Amanda
Sure:
char cmd[1024]
snprintf(cmd, sizeof(cmd), "xdg-mime query default %s", somemime_variable);
popen(cmd, "r");
It seems no way to do this. I'll try to use pure shell script, no the c code.
精彩评论