How to get the output of a system command in C

How to get the output of a system command in C?

The system function is handy. But how to get the output?

popen is a useful function for this purpose:

http://www.pkill.info/linux/man/3p-popen/

You can use normal file operation functions like fgets to read file content from the file opened by popen.

Answered by anonymous.

Leave a Reply

Your email address will not be published. Required fields are marked *