Perl and PHP do this with backticks. For example,
$output = `ls`;
Returns a directory listing. A similar function, system(\"foo\")
system(\"foo\")
In C on Posix conformant systems:
#include FILE* stream = popen("/path/to/program", "rw"); fprintf(stream, "foo\n"); /* Use like you would a file stream. */ fclose(stream);