Previous Up Next

C.9  Communication via ECLiPSe Streams

These functions allow exchanging data with an embedded ECLiPSe via queue streams created by the ECLiPSe code. Queue streams can be created either by using open/3 and open/4 from within ECLiPSe code, or by initializing ECLiPSe with the MEMORY_IO option. In the latter case, the streams 0, 1 and 2 are queues corresponding to ECLiPSe’s input, output and error streams.

int ec_queue_write(int stream, char *data, int size)

Write string data into the specified ECLiPSe queue stream. Data points to the data and size is the number of bytes to write. The return value is 0 for success, or a negative error number.
int ec_queue_read(int stream, char *buf, int size)

Read string data into the specified ECLiPSe queue stream. Buf points to a data buffer and size is the buffer size. The return value is either a negative error code, or the number of bytes read into buffer.
int ec_queue_avail(int stream)

Determines the number of bytes that are available and can be read from the given queue stream. The return value is either that number or a negative error code.
int ec_stream_nr(char *name)

Get the stream number of the named stream. If the return value is negative then there is no open stream with the specified name. This is the same operation that the ECLiPSe built-in get_stream/2 performs).

Previous Up Next