-   Programming (
-   -   System V message queues... (

sachitha 03-04-2006 11:17 PM

System V message queues...
How do you send "3 types" of information to a message queue?? and again read all 3 of them in to variables from the message queue?
i know how to send and receive 2 types of information .. like <type-some integer> <message-text>

i need to know to send and receive 3 types such as
<cutomer_type(character array)> <integer value1> <integer value2>
is it possible like that to have the message type as a character array, like how i have specified in the above line???

if i state it more clearly ,
i need to read the following type of lines from a file and send it to a message queue..
0 cus_G 23
1 cus_H 20
2 cus_G 12
i have decided to make cus_X as the <msg type>, is that wrong?

plz help me out. i'm really confused as to where and how i can make the changes to the message queue structures....

rajtendulkar 03-17-2006 10:44 PM

If you refer to the book
GNU/Linux Application Programming by M. Tim Jones
you will find it out...

still i will give it over here for U

you define your message as

typedef struct {
long type;
long var1;
float var2;
char var3;
int var4;

define object as
MSG_TYPE msg_obj;

when u do the msgsnd the second argument should be typecasted to (struct msgbuf *)&msg_obj

same while receiving the message :)

I hope this helps...


sachitha 03-19-2006 08:12 AM

Thank you.. !

All times are GMT -5. The time now is 05:17 PM.