Anonymous user
Execute a system command: Difference between revisions
no edit summary
(→{{header|Objective-C}}: added complete example (because of NSAutoreleasePool I believe it is needed)) |
No edit summary |
||
Line 1:
{{Task|Programming environment operations}}
In this task, the goal is to run either the <
=={{header|Ada}}==
Line 112:
=={{header|Java}}==
{{works with|Java|1.5+}}
<lang java>import java.util.Scanner;
import java.io.*;
Line 126:
}
}
}</
{{works with|Java|1.4+}}
Line 281:
<!-- {{libheader|Cocoa}} -->
<lang objc>#import <Cocoa/Cocoa.h>
//works also with
//#import <Foundation/Foundation.h>
Line 302:
[pool release];
return 0;
}</
Line 310:
Just run the command:
<lang ocaml>Sys.command "ls"</
To capture the output of the command:
<lang ocaml>#load "unix.cma";;
let syscall cmd =
let inc, outc = Unix.open_process cmd in
Line 325:
let _status = Unix.close_process (inc, outc) in
Buffer.contents buf;;
let listing = syscall "ls";;</
=={{header|Perl}}==
|