Lasso Soft Inc. > Home

[ file_modeLine ]

Method

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.

  • Syntax
file_modeLine

file('/path/to/a/file', io_file_o_rdonly, file_modeLine)
Examples
  • Intermediate

Open a file for reading a line at a time

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"

Recent Comments

No Comments found

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. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft