I haven't found any satisfactory answer so excuse me if this has already been answered before.
Basically I'd like to be able to call a program and inject some data in its stdin and read it's stdout from within a C program.
I'd like to emulate this:
cat data.txt | program
where the output of program is captured and the data is written to stdin of said program.
It's a bit like this question but in C instead of python and I don't need the subprocess to live forever, just execute with input data, spit out the output and die.
Repeatedly write to STDIN and read STDOUT of a Subprocess without closing it