ctSysQueueRead
Read data from the queue.
Short Name
ctSysQueueRead()
Type
ISAM function.
Declaration
NINT ctSysQueueRead(NINT qhandle, pVOID buffer, NINT buflen, LONG timeout)
Description
Data is read from the queue by calling ctSysQueueRead().
Parameter qhandle is a system queue handle returned by a call to ctSysQueueOpen(), while timeout specifies a millisecond time that ctSysQueueRead() will block waiting for data. A timeout of ctWAITFOREVER will cause ctSysQueueRead() to block until data is available in the queue. Parameter buffer is a pointer to a memory block large enough to hold the next message in the queue, and buflen indicates the size in bytes of buffer.
ctSysQueueMlen() may be used to retrieve the next message length, while ctSysQueueCount() may be used to retrieve the number of messages waiting in the queue.
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful function. |
90 |
NQUE_ERR |
Could not create queue. |
514 |
CQUE_ERR |
Queue has already been closed. |
638 |
TQUE_ERR |
Queue message truncated to fit. |
See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.
Example
TEXT msg[128];
NINT eRet = ctSysQueueRead(qhandle, msg, sizeof(msg), ctWAITFOREVER);
if (eRet)
printf("ctSysQueueRead failed with code %d\n", eRet);
Limitations
Client/Server mode only.
See also
ctSysQueueMlen, ctSysQueueCount