Lasso Soft Inc. > Home

[ file_stdin ]

Method

The [file_stdin] method takes no parameters and returns a [file] object that can interact with standard in I/O stream.

  • Syntax
var(stdin) = file_stdin
Examples
  • Advanced

Interactively run Lasso code

The example below is taken from the lasso9 binary that allows you to interactively run lasso commands. The code displays a prompt to standard out and waits for input. It reads the input from standard in and tries to process it as Lasso code.

Code

while(true) => {        
    stdout('>: ')
    local(r = file_stdin->readSomeBytes(1024, 1000))
    while(not #r or #r->size == 0) => {
        #r = file_stdin->readSomeBytes(1024, 1000)
    }
    protect => {
        handle_failure => {
            stdoutnl(''+error_code+' '+error_msg)
        }
        local(cb = sourcefile(string(#r), 'interactive', true, false))
        stdoutnl(#cb())
    }
}

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