The [file_modeLine] constant returns a value that the [file] type uses to set the file get mode to read a line at a time.
file_modeLine
file('/path/to/a/file', io_file_o_rdonly, file_modeLine)
The code below reads through a file a line at a time and writes its contents to standard out.
Code
local(f) = file('/path/to/file.txt', io_file_o_rdonly, file_modeLine)
handle => { #f->close }
local(next_line) = #f->get
while(#next_line) => {
stdoutnl(#next_line)
#next_line = #f->get
}
Result
The contents of the file will be printed to standard out, similar to the unix command "cat"
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments