Possible Duplicate:
How can I run an external program from C and parse its output?
I want to run a command in linux and get the text returned of what it outputs, but I do not want this text printed to screen. Is there a more elegant way than making a temporary file?
You need some sort of Inter Process Communication. Use a pipe or a shared buffer.
You want the "popen" function. Here's an example of running the command "ls /etc" and outputing to the console.
Usually, if the command is an external program, you can use the OS to help you here.
So your C code would be doing something like
Then you can use the file_output.txt file.