I am writing some software which takes a list of files and converts a bunch of text in them.
I have wrote a couple modules already which takes data from stdinput, operates on it and outputs to the stdoutput. I did it this way as it is flexable and the invididual modules are helpful on my system.
I am now working on a program which takes all of my executable modules and will run them according to a template supplied but I do not know how to call a program within C and be able to post data to stdin and read the result from stdout. I am using C code and do not wish to do this using batch scripts or such.
I Have 1 file called test.mpr containing "Good Morning World "
1 Module called replace which takes 2 arguments <searchstring> <replacestring>
I can accomplish what I want from a terminal like so.
cat test.mpr | replace "Morning" "Night" > output.mpr
output.mpr now will contain "Good Night World"
How can I accomplish the same thing using strictly C?
I would like to keep my code as cross compatible as possible aswell.
Im sure its an simple task I just can't seem to find exactly what im looking for.
Thanks in advance.