Difference between revisions of "Oscli"
From Mesham
Jump to navigationJump to search (Created page with '== Overview == This oscli[a] function will pass the command line interface (e.g. Unix or MS DOS) command to the operating system for execution. * '''Pass:''' A string represent…') |
m (4 revisions imported) |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
| − | This oscli | + | This oscli(a) function will pass the command line interface (e.g. Unix or MS DOS) command to the operating system for execution. |
| − | * '''Pass:''' A | + | * '''Pass:''' A [[String]] representing the command |
* '''Returns:''' Nothing | * '''Returns:''' Nothing | ||
| + | * '''Throws:''' The error string ''oscli'' if the operating system returns an error to this call | ||
== Example == | == Example == | ||
| − | var a:String; | + | #include <io> |
| − | + | #include <system> | |
| − | + | ||
| + | function void main() { | ||
| + | var a:String; | ||
| + | input(a); | ||
| + | try { | ||
| + | oscli(a); | ||
| + | } catch ("oscli") { | ||
| + | print("Error in executing command\n"); | ||
| + | }; | ||
| + | }; | ||
| − | The above program is a simple interface, allowing the user to input a command and then passing this to the OS for execution. | + | The above program is a simple interface, allowing the user to input a command and then passing this to the OS for execution. The ''oscli'' call is wrapped in a try-catch block which will detect when the user has request the run of an errornous command, this explicit error handling is entirely optional. |
| + | |||
| + | ''Since: Version 0.5'' | ||
[[Category:Function Library]] | [[Category:Function Library]] | ||
[[Category:System Functions]] | [[Category:System Functions]] | ||
Latest revision as of 15:44, 15 April 2019
Overview
This oscli(a) function will pass the command line interface (e.g. Unix or MS DOS) command to the operating system for execution.
- Pass: A String representing the command
- Returns: Nothing
- Throws: The error string oscli if the operating system returns an error to this call
Example
#include <io>
#include <system>
function void main() {
var a:String;
input(a);
try {
oscli(a);
} catch ("oscli") {
print("Error in executing command\n");
};
};
The above program is a simple interface, allowing the user to input a command and then passing this to the OS for execution. The oscli call is wrapped in a try-catch block which will detect when the user has request the run of an errornous command, this explicit error handling is entirely optional.
Since: Version 0.5