Difference between revisions of "MQOPEN()"

From Lianjapedia
Jump to: navigation, search
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Open a pointer to a message queue
 
Open a pointer to a message queue
 
  
 
==Syntax==
 
==Syntax==
 
MQOPEN(<expC> [,<expN>])
 
MQOPEN(<expC> [,<expN>])
 
  
 
==See Also==
 
==See Also==
 
[[MQCLOSE()]], [[MQCREATE()]], [[MQCURMSGS()]], [[MQRECEIVE()]], [[MQSEND()]], [[MQUNLINK()]], [[XML_DECODE()]], [[XML_ENCODE()]], [[XML_GATHER()]], [[XML_SCATTER()]]
 
[[MQCLOSE()]], [[MQCREATE()]], [[MQCURMSGS()]], [[MQRECEIVE()]], [[MQSEND()]], [[MQUNLINK()]], [[XML_DECODE()]], [[XML_ENCODE()]], [[XML_GATHER()]], [[XML_SCATTER()]]
 
  
 
==Description==
 
==Description==
 
The MQOPEN() function opens an existing message queue.  It returns a numeric pointer when the queue is opened successfully, or a -1 if unsuccessful.  The <expC> is the name of the queue to open.  Since the pointer is required to identify an open queue to other messaging functions, always assign the return value to a memory variable.  The optional <expN> determines the queue access mode:
 
The MQOPEN() function opens an existing message queue.  It returns a numeric pointer when the queue is opened successfully, or a -1 if unsuccessful.  The <expC> is the name of the queue to open.  Since the pointer is required to identify an open queue to other messaging functions, always assign the return value to a memory variable.  The optional <expN> determines the queue access mode:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 27: Line 23:
 
|-
 
|-
 
|}
 
|}
 
  
 
The MQCLOSE() function is used to close a queue which has been opened with MQOPEN() or MQCREATE().
 
The MQCLOSE() function is used to close a queue which has been opened with MQOPEN() or MQCREATE().
  
 
For more examples of handling message queues, please see the examples/mqueue programs in the software distribution.
 
For more examples of handling message queues, please see the examples/mqueue programs in the software distribution.
 
  
 
==Example==
 
==Example==
Line 51: Line 45:
 
mqclose(mqdes)
 
mqclose(mqdes)
 
</code>
 
</code>
 
  
 
==Products==
 
==Products==

Revision as of 13:02, 11 December 2012

Purpose

Open a pointer to a message queue

Syntax

MQOPEN(<expC> [,<expN>])

See Also

MQCLOSE(), MQCREATE(), MQCURMSGS(), MQRECEIVE(), MQSEND(), MQUNLINK(), XML_DECODE(), XML_ENCODE(), XML_GATHER(), XML_SCATTER()

Description

The MQOPEN() function opens an existing message queue. It returns a numeric pointer when the queue is opened successfully, or a -1 if unsuccessful. The <expC> is the name of the queue to open. Since the pointer is required to identify an open queue to other messaging functions, always assign the return value to a memory variable. The optional <expN> determines the queue access mode:

<expN> Access Mode
Unspecified Read only access
0 Read only access
1 Write only access
2 Read/Write access

The MQCLOSE() function is used to close a queue which has been opened with MQOPEN() or MQCREATE().

For more examples of handling message queues, please see the examples/mqueue programs in the software distribution.

Example

mqdes=mqopen("/myqueue")
if (mqdes < 0)
    messagebox(strerror()+",errno="+alltrim(str(error())))
    return
endif
do while (mqcurmsgs(mqdes) > 0)
    mstr=mqreceive(mqdes)
    if (empty(mstr))
        messagebox(strerror()+",errno="+alltrim(str(error())))
        return
    endif
    messagebox(mstr)
enddo
mqclose(mqdes)

Products

Lianja, Lianja Server