Module Stdio

Inheritance graph
predef::_Stdio predef::Stdio 8.0::Stdio

Inherit _Stdio

inherit _Stdio : _Stdio


Typedef read_callback_t

local typedef function(mixed|void, string:int|void)|function(mixed|void, Buffer:int|void)|function(mixed|void:int|void)|zero Stdio.read_callback_t

Description

The various read_callback signatures.

The string (or void) version is used when buffer mode (see set_buffer_mode) has not been enabled for reading.

The Buffer version is used when a Buffer has been enabled for reading.

In both cases the data is the newly arrived data, but in buffered mode data you did not fully read in the last read callback is kept in the buffer.


Typedef write_callback_t

local typedef function(mixed|void:int|void)|function(mixed|void, Buffer:int|void)|zero Stdio.write_callback_t

Description

The various write_callback signatures.

The void version is used when buffer mode (see set_buffer_mode) has not been enabled for writing.

The Buffer version is used when a Buffer has been enabled for writing, add data to that buffer to send it.


Constant DATA_CHUNK_SIZE

final constant int Stdio.DATA_CHUNK_SIZE

Description

Size used in various places to divide incoming or outgoing data into chunks.


Constant TCSADRAIN

constant string Stdio.TCSADRAIN

Description

Argument to Stdio.File()->tcsetattr().

Change after all output has been written.


Constant TCSAFLUSH

constant string Stdio.TCSAFLUSH

Description

Argument to Stdio.File()->tcsetattr().

Change after all output has been written, and empty the input buffers.


Constant TCSANOW

constant string Stdio.TCSANOW

Description

Argument to Stdio.File()->tcsetattr().

Change immediately.


Variable stderr

FILE Stdio.stderr

Description

An instance of FILE("stderr"), the standard error stream. Use this when you want to output error messages.

See also

werror()


Variable stdin

FILE Stdio.stdin

Description

An instance of FILE("stdin"), the standard input stream. Use this when you want to read anything from the standard input. This example will read lines from standard input for as long as there are more lines to read. Each line will then be written to stdout together with the line number. We could use Stdio.stdout.write() instead of just write(), since they are the same function.

Example

int main() { int line; while(string s=Stdio.stdin.gets()) write("%5d: %s\n", line++, s); }


Variable stdout

FILE Stdio.stdout

Description

An instance of FILE("stdout"), the standatd output stream. Use this when you want to write anything to the standard output.

See also

write()