I have an Executable program which runs the other program named main.cpp from it.
Main.cpp both have stdout and stderr message
I need to redirect both stdout and stderr message to one file .
I tried with different option but none of them helps.
This is executable.cpp
I got all the output in terminal when I tried this, but empty file some.txt created.
system("g++ -g main.cpp -o a.out");
system("./a.out &>> some.txt");
Only the stderr message is saved in some.txt but stdout messagae is dispalyed on terminal.
system("./a.out 2>> some.txt");
How can I save both message to other file at a single time while running program.