digitalmars.D.learn - How to call external program in D
- Sparsh Mittal (6/6) Nov 16 2012 I am new to D.
- Adam D. Ruppe (13/14) Nov 16 2012 This function should do for many tasks:
- Sparsh Mittal (1/1) Nov 16 2012 Thanks a lot, it was very helpful.
- =?UTF-8?B?UmFwaGHDq2wgSmFrc2U=?= (7/13) Nov 17 2012 This is out of subject but for ls and date, you might want to get the
I am new to D. Can you please tell, how to call external program in D. Example: in C, one can do this: http://stackoverflow.com/questions/43116/how-can-i-run-an-external-program-from-c-and-parse-its-output I want to call an external program (e.g. ls or date) in D. Thanks
Nov 16 2012
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.
Nov 16 2012
Le 16/11/2012 20:15, Sparsh Mittal a écrit :I am new to D. Can you please tell, how to call external program in D. Example: in C, one can do this: http://stackoverflow.com/questions/43116/how-can-i-run-an-external-program-from-c-and-parse-its-output I want to call an external program (e.g. ls or date) in D. ThanksThis is out of subject but for ls and date, you might want to get the informations directly in D. See - http://dlang.org/phobos/std_date.html - http://dlang.org/phobos/std_datetime.html - http://dlang.org/phobos/std_file.html#dirEntries
Nov 17 2012