Here's an example code to reproduce my problem:
#include <stdio.h>
int main()
{
char *f = "toto.txt";
char cmd[64];
sprintf(cmd, "nano %s", f);
system(cmd);
return 0;
}
If I do:
./test
Everything is fine, but if I do:
echo "blah"|./test
Nano fails:
received SIGHUP or SIGTERM
Is there a safer way to execute system commands ? I've already tried redirecting stdin.