fn: read



The syntax for read calls is:

read{option}(istream, params)

@read{option}(istream, params)


The read function is for reading input, it takes a non-zero number of parameters, the first parameter should be an input stream (either console, a file stream or a string stream), the remainder of the parameters should be either ofile where input is injected directly to the file being built or a variable name to read in to. Having one input parameter is the same as having a second parameter that is ofile. If not reading to the output file being built read will return whether or not it was successful.


The following options are available for read calls:

option description
!r no return value
option description

f++ example

Examples of read being used with f++:

:=(string, s)
:=(int, i)
read(console, s, i)

:=(string, s)
:=(ifstream, ifs("input.txt"))
read(ifs, s, i)

n++ example

Examples of read being used with n++:

@:=(string, s)
@:=(int, i)
@read(console, s, i)

@:=(string, s)
@:=(ifstream, ifs("input.txt"))
@read(ifs, s, i)