-
Notifications
You must be signed in to change notification settings - Fork 0
The IO Standard Library
This library spans common input and output functions including file reading and writing, inputs from various devices (mouse, keyboard) and serial output.
Gets input from the default input method, usually the keyboard (unless one isn't connected).
Parameters:
None.
Usage:
let x = input.get(); //type "foo"
print x; //"foo" is printed
Returns the contents of the given file, using relative or absolute path, based on the .NET Pathing Engine.
Parameters:
Name | Description |
---|---|
path | The path of the file to read from. |
Usage:
let x = input.fromFile("example.txt");
print x; //prints the contents of example.txt
Outputs the given string to a file, using relative or absolute path, based on the .NET Pathing Engine. Overwrites any content that was previously in the file.
Parameters:
Name | Description |
---|---|
path | The path of the file to write to. |
content | The content to write to the file. Must be a string. |
Usage:
let x = "Write me somewhere!";
output.toFile("example.txt", x); //puts "Write me somewhere!" into example.txt.
Sets the output colour for future print
statements. The colour is an enum value from the consoleColours
enum.
Parameters:
Name | Description |
---|---|
colour | A consoleColours enum value. |
Usage:
output.setConsoleColour(consoleColour.Black); //set the console text colour to black
An enum that represents all colours available to set the console text to. Used in output.setConsoleColour
.
Values:
Black,
DarkBlue,
DarkGreen,
DarkCyan,
DarkRed,
DarkMagenta,
DarkYellow,
Gray,
DarkGray,
Blue,
Green,
Cyan,
Red,
Magenta,
Yellow,
White
Creates a file on disk, and writes a blank string to it. Uses relative or absolute path, based on the .NET Pathing Engine. The directories that the file is being created in must all exist, otherwise an error will be thrown.
Parameters:
Name | Description |
---|---|
path | The path to create a file at. |
Usage:
output.createFile("example.txt"); //creates "example.txt" in the executing directory.
Checks whether a file exists at the given path. Returns a boolean value.
Parameters:
Name | Description |
---|---|
path | The file to check the existence of. |
Usage:
if (file.exists("example.txt"))
{
print "./example.txt exists!";
}
Algo (c) Larry Tang, 2019.
Commercial use of Algo must include the LICENSE
file in the same directory as the executable.
Standard Library Documentation: