Return to homepage

DOSATO

Copyright © 2024 Sebastiaan Heins

3.4 Input and output

Functions

void say (var val, var other ...)

Prints the given values to the console.
The value is converted to a string before being printed.

void sayln (var val, var other ...)

Prints the given values to the console, followed by a newline.
The value is converted to a string before being printed.

string listen (string prompt = ?, char delimiter = ?)

Prints the given prompt (optional) to the console, then waits for the user to input a string.
When the user presses enter, the input is returned as a string.
The program will wait for the user to input a string, so the program will not continue until the user has input a string.

File IO

string read (string path)

Reads the contents of the file at the given path and returns it as a string.
If the file does not exist, err53:ERROR_FILE_NOT_FOUND is thrown.
If the program does not have permission to read the file, err55:ERROR_PERMISSION_DENIED is thrown.

void write (string path, string content)

Writes the given content to the file at the given path.
If the file does not exist, it is created.
If the program does not have permission to write to the file or create it, err55:ERROR_PERMISSION_DENIED is thrown.

void append (string path, string content)

Appends the given content to the file at the given path.
If the file does not exist, it is created.
If the program does not have permission to write to the file or create it, err55:ERROR_PERMISSION_DENIED is thrown.

void delete (string path)

Deletes the file at the given path.
If the file does not exist, err53:ERROR_FILE_NOT_FOUND is thrown.
If the program does not have permission to delete the file, err55:ERROR_PERMISSION_DENIED is thrown.

bool exists (string path)

Returns true if the file at the given path exists, false otherwise.

bool move (string path)

Moves the file at the given path to the trash.
If the file does not exist, err53:ERROR_FILE_NOT_FOUND is thrown.
If the program does not have permission to move the file to the trash, err55:ERROR_PERMISSION_DENIED is thrown.

bool copy (string path)

Copies the file at the given path to the trash.
If the file does not exist, err53:ERROR_FILE_NOT_FOUND is thrown.
If the program does not have permission to copy the file to the trash, err55:ERROR_PERMISSION_DENIED is thrown.