I know that the function:
system("myfile.sh")
exec a bash script.
Ok but now I want to redirect the output to my program to ensure the reading.
For example the script date.sh give me the date of my system, and i want to see it on my program with std::cout << OUTPUTDATE;
Is it possible?
How?
Use
popeninstead ofsystem.The function
popenwill give you aFILE *you can read from.