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

MsgRead

Reads a message from a message session. You can call this function only in a message post function (the callback function specified in the MsgOpen() function), to read the current message.

The Type and Str variables of this function return the message number and the text of the message. The return value of this function is the message handle (allowing a response to be sent back if required).

you need to open the message session using the MsgOpen() function, to enable the callback function.

Syntax

MsgRead(Type, Str)

Type:

The message number.

Str:

The message text.

Return Value

The message handle of the message being read.

Related Functions

MsgOpen, MsgClose, MsgWrite, MsgRPC

Example

/* This function will read a message from the session and if 
Type=1, will display the string as a prompt. If Type=2 then the 
speaker beeps and an acknowledgment is sent back to the caller. */
INT
FUNCTION
MsgPostClient()
INT Type;
STRING Str;
INT hMsg;
hMsg=MsgRead(Type,Str);
IF Type=1 THEN
Prompt("Message"+Str);
ELSE
IF Type=2 THEN
Beep();
MsgWrite(hMsg,2,"DONE");
END
END END

See Also

Task Functions