Skip to content

I/O

print

Overload Description
print(obj: Int) -> () Prints obj to stdout
print(obj: Float) -> ()
print(obj: Bool) -> ()
print(obj: Str) -> ()
print(obj: &Int | @Int) -> ()
print(obj: &Float | @Float) -> ()
print(obj: &Bool | @Bool) -> ()
print(obj: &Str | @Str) -> ()

get_file

Overload Description
get_file(path: String) -> File Gets handle for the file located at path

open

Overload Description
open(file: @File, r: Bool, w: Bool, a: Bool) -> () Opens file with permissions to read (r), write (w) and append (a)

close

Overload Description
close(file: @File) -> () Closes the handle of the file. You can reuse the handle by using the open function

exists

Overload Description
exists(file: @File) -> Bool returns true if the file exists in the file system

delete

Overload Description
delete(file: @File) -> Bool Remove file and return true if it succeeded. You can reuse the handle by using the open function

read_str

Overload Description
read_str(file: @File) -> String Read the contents of file as a String

read_bytes

Overload Description
read_bytes(file: @File) -> Array<Int> Read the contents of file as an Array of bytes
read_bytes(file: @File, n: Int) -> Array<Int> Read n bytes from file

write_str

Overload Description
write_str(file: @File, str: &String) -> Bool Write the contents of str to file and return true if it succeeded

write_bytes

Overload Description
write_bytes(file: @File, bytes: &Array<Int>) -> Bool Write the contents of bytes to file and return true if it succeeded

input

Overload Description
input() -> String Asks for user input on console and returns it

num_args

Overload Description
num_args() -> Int Returns the number of arguments received from stdin

get_arg

Overload Description
get_arg(i: Int) -> String Returns the i'th argument received from stdin