Module io
An implementation of the Erlang/OTP io interface.
Description
This module implements a strict subset of the Erlang/OTP io interface.
Data Types
device()
device() = atom() | pid() | standard_io() | standard_error() | user()
format()
format() = atom() | string() | binary()
getopt()
getopt() = {echo, boolean()} | {binary, boolean()} | {encoding, unicode} | {terminal, boolean()} | {stdin, boolean()} | {stdout, boolean()} | {stderr, boolean()}
standard_error()
standard_error() = standard_error
standard_io()
standard_io() = standard_io
user()
user() = user
Function Index
columns/0 | Returns the number of columns for standard I/O. |
columns/1 | Returns the number of columns for passed I/O device. |
format/1 | Equivalent to fwrite(Format). |
format/2 | Equivalent to fwrite(Format, Data). |
format/3 | Equivalent to fwrite(IODevice, Format, Data). |
fwrite/1 | Equivalent to fwrite(Format, []). |
fwrite/2 | Equivalent to fwrite(standard_io, Format, Data). |
fwrite/3 | Format string and data to IO device. |
get_line/1 | Read string from console with prompt. |
getopts/0 | Get all options for standard I/O. |
getopts/1 | Get all options for a given IODevice. |
printable_range/0 | Returns the user-requested range of printable Unicode characters. |
put_chars/1 | Writes the given character(s) to the console. |
put_chars/2 | Writes the given character(s) to the given device. |
requests/1 | |
scan_erl_exprs/4 | Reads data from IODevice with a given prompt. |
Function Details
columns/0
columns() -> {ok, pos_integer()} | {error, enotsup}
Equivalent to columns(standard_io)
.
Returns the number of columns for standard I/O.
columns/1
columns(IODevice::device()) -> {ok, pos_integer()} | {error, enotsup}
IODevice
: IO device to get columns of
Returns the number of columns for passed I/O device.
format/1
format(Format::format()) -> ok
Equivalent to fwrite(Format)
.
format/2
format(Format::format(), Data::[term()]) -> ok
Equivalent to fwrite(Format, Data)
.
format/3
format(IODevice::device(), Format::format(), Data::[term()]) -> ok
Equivalent to fwrite(IODevice, Format, Data)
.
fwrite/1
fwrite(Format::format()) -> ok
Equivalent to fwrite(Format, [])
.
fwrite/2
fwrite(Format::format(), Data::[term()]) -> ok
Equivalent to fwrite(standard_io, Format, Data)
.
fwrite/3
fwrite(IODevice::device(), Format::string(), Args::list()) -> string()
IODevice
: device to write toFormat
: format string
returns: ok
Format string and data to IO device. See io_lib:format/2 for information about formatting capabilities.
get_line/1
get_line(Prompt::string()) -> string()
Prompt
: prompt for user input
returns: string
Read string from console with prompt.
getopts/0
getopts() -> [getopt()] | {error, Reason::any()}
Equivalent to getopts(standard_io)
.
Get all options for standard I/O
getopts/1
getopts(IODevice::device()) -> [getopt()] | {error, Reason::any()}
IODevice
: IO device to get options for
Get all options for a given IODevice
printable_range/0
printable_range() -> unicode | latin1
Returns the user-requested range of printable Unicode characters.
Currently always returns unicode
put_chars/1
put_chars(Chars::list() | binary()) -> ok
Chars
: character(s) to write to console
returns: ok
Equivalent to put_chars(standard_io, Chars)
.
Writes the given character(s) to the console.
put_chars/2
put_chars(Device::device(), Chars::list() | binary()) -> ok
Device
: device to send characters toChars
: character(s) to write to device
returns: ok
Writes the given character(s) to the given device.
requests/1
requests(Requests) -> any()
scan_erl_exprs/4
scan_erl_exprs(IODevice::device(), Prompt::atom() | unicode:chardata(), StartLocation::any(), Options::any()) -> {ok, Tokens::any(), EndLocation::any()} | {eof, EndLocation::any()} | eof | {error, any()}
IODevice
: device to read fromPrompt
: prompt to printStartLocation
: start location for readingOptions
: options for tokenizing
returns: read tokens or an error
Reads data from IODevice with a given prompt