16 lines
331 B
Plaintext
16 lines
331 B
Plaintext
# This script reads the contents of a file.
|
|
|
|
name = 'examples/algorithms/bubble_sort.noja';
|
|
buff = buffer.new(1024);
|
|
|
|
handle, err = files.openFile(name, files.READ);
|
|
if handle == none:
|
|
error(err);
|
|
|
|
n = files.read(handle, buff);
|
|
|
|
resl = buffer.toString(buffer.sliceUp(buff, 0, n));
|
|
|
|
print('Read ', n, ' bytes.\n');
|
|
print(resl);
|