Get the result of a Shell Commands within C

Tags: c shell mixing
By : jamel
Source: Stackoverflow.com
Question!

I'm trying to find a function to call a system command (shell command) and get back its result in a C program. I only found functions like system but these don't return the result of the command.

I just know it in perl : my $results = `my shell command ;

Thanks!

By : jamel


Answers

You're looking for popen(), at least on POSIX (Linux etc) systems. In Windows, a different solution is likely needed.

By : unwind


This video can help you solving your question :)
By: admin