Cicode Programming Reference > Cicode Function Categories > Task Functions Introduction > QueRead


Reads data from a queue, starting from the head of the queue. Data is returned in the same order as it was written onto the queue and is removed from the queue when read. If the Mode is 0 (non-blocking) and the queue is empty, the function returns with an error. If the Mode is 1 (blocking) the function does not return until another Cicode task writes data onto the queue.

This function is a blocking function. It will block the calling Cicode task until the operation is complete.


QueRead(hQue, Type, Str, Mode)


The queue handle, returned from the QueOpen() function. The queue handle identifies the table where all data on the associated queue is stored.


The integer variable to read from the queue (written to the queue as Type by the QueWrite() function).


The string variable to read from the queue (written to the queue as Str by the QueWrite() function).


The mode of the read:

0 - Non-blocking.

1 - Wait for element.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

QueClose, QueLength, QueOpen, QueWrite, QuePeek


IF Status = 0 THEN
! Now use Type and Str.

See Also

Task Functions