On Friday, 16 November 2012 at 19:15:09 UTC, Sparsh Mittal wrote:
I want to call an external program (e.g. ls or date) in D.

This function should do for many tasks:


http://dlang.org/phobos/std_process.html#shell

string shell(string cmd);
Runs cmd in a shell and returns its standard output. If the process could not be started or exits with an error code, throws an exception.

Or maybe this one:
http://dlang.org/phobos/std_stdio.html#popen

(also search that page for the other popen, which calls the C function without the need for a File struct)

Generally, anything you can do in C, you can also do in D by calling the C functions directly.

Reply via email to