| Format | open_null_stream(-Handle) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Note | The reasons because the predicate can fail are.
| |||
| Open an empty stream. | ||||
> :- open_null_stream(X). | ||||
| Format | open_socket_stream(+Host, +Port, -Handle) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | The predicate will fail in the next cases.
| ||||||
| Open a socket stream. | |||||||
> :- open_socket_stream("dallmayr", 12345, X). | |||||||
| Format | open_pty_stream(+Name, +Args, -Handle) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| |||||||||
| Open a pseudo-terminal stream to communicate with an external command through standard I/O. | ||||||||||
| Format | open_process_stream(+Name, +Args, +Mode, -Handle) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||||||||
| Open a stream to communicate with an external command via standard input or output. | |||||||||||||
| Format | open_file_stream(+Name, +Mode, -Handle) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| |||||||||
| Note | Below is the list of modes.
| |||||||||
| Open a file stream. | ||||||||||
> :- open_file_stream("/etc/passwd", "r", X).
| ||||||||||
| Format | open_server_stream(+Port,-Handle) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | This predicate fails on the following condition.
| ||||||
| Open port for server. | |||||||
> ?- open_server_stream(8500, X). | |||||||
| Format | accept_connection(+Handle) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Accept connection to server stream Handle. | ||||
> ?- open_server_stream(8500, X), accept_connection(X). | ||||
| Format | close_connection(+Handle) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Close connection to server stream Handle. | ||||
| Format | write_string(+Handle, +String) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | The reasons because the predicate can fail are.
| ||||||
| Write a string into a stream handle. | |||||||
> :- open_file_stream("hoge", "w", X), write_string(X, "poge"). | |||||||
| Format | writeln_string(+Handle, +String) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | The reasons because the predicate can fail are.
| ||||||
| Write a string into a stream handle. Also write a new line character. | |||||||
> :- open_file_stream("hoge", "w", X), writeln_string(X, "poge"). | |||||||
| Format | write_string_list(+Handle, +List) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | The reasons because the predicate can fail are.
| ||||||
| Write a list of strings (or integers) into a stream handle. | |||||||
| Format | writeln_string_list(+Handle, +List) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | The reasons because the predicate can fail are.
| ||||||
| Write a list of strings (or integers) into a stream handle. Also write a new line character. | |||||||
| Format | read_string(+Handle, +Len, -String) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| |||||||||
| Note | The reasons because the predicate can fail are.
| |||||||||
| Read a string from a handle. | ||||||||||
> :- open_file_stream("/etc/passwd", "r", X), read_string(X, 10, Y). | ||||||||||
| Format | readln_string(+Handle, -String) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | The reasons because the predicate can fail are.
| ||||||
| Read a string from the stream. It stops when find a new line character. | |||||||
> :- open_file_stream("/etc/passwd", "r", X), readln_string(X, Y). | |||||||
| Format | write_stream(+Handle, +Data) | ||||||
|---|---|---|---|---|---|---|---|
| Arguments |
| ||||||
| Note | The reasons because the predicate can fail are.
| ||||||
| Write the binary data into the stream. | |||||||
> :- open_file_stream("/etc/passwd", "r", X), readln_string(X, Y). | |||||||
| Format | read_stream(+Handle, +Len, -Data) | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Arguments |
| |||||||||
| Note | The reasons because the predicate can fail are.
| |||||||||
| Read the binary data from the stream. | ||||||||||
> :- open_file_stream("/etc/passwd", "r", X), read_stream(X, 10, Y). | ||||||||||
| Format | close(+Handle) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Note | The reasons because the predicate can fail are.
| |||
| Close a stream . | ||||
> :- close(X). | ||||
| Format | flush_output(+Handle) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Note | The reasons because the predicate can fail are.
| |||
| Flush the stream's buffer. | ||||
> :- flush_output(X). | ||||
| Format | eof_stream(+Handle) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Note | The reasons because the predicate can fail are.
| |||
| Says if the end of the stream has been reached. | ||||
> ?- eof_stream(X). | ||||
| Format | stdin_stream(-Handle) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Return the handle of stdin. | ||||
> :- stdin_stream(X). | ||||
| Format | stdout_stream(-Handle) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Return the handle of stdout. | ||||
> :- stdout_stream(X). | ||||
| Format | stderr_stream(-Handle) | |||
|---|---|---|---|---|
| Arguments |
| |||
| Return the handle of stderr. | ||||
> :- stderr_stream(X). | ||||