I have a program that is supposed to run valgind on another program and direct the valgrind output to another file. The code I'm using is:
char* args[] = {"sudo", //(This is inside a fork)
"valgrind",
"--leak-check=full",
"--show-leak-kinds=definite",
"--errors-for-leak-kinds=definite",
"<path to executable>", //placeholders
"&><path to output file>", //placeholders
"\0"};
execvp("sudo",args);
The problem I'm getting is that no matter what I do, it doesn't actually direct the output anywhere but the terminal.
I've tried "&>" and ">" with no change. I've tried running it in terminal with redirected output to file, I've also tried running it in eclipse with terminal arguments, etc. I'm not sure what else I can try.
Does anyone have any idea why "&>" isn't redirecting? I have confirmed that typing the args array in the terminal (not as part of the program) does work. It seems to just be something with the c++ program (possibly fork?).
I recommend you to use
--log-file=<filename>
option.From manual: