LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 03-04-2006, 11:17 PM   #1
sachitha
Member
 
Registered: Aug 2003
Location: Sri Lanka
Distribution: Redhat 9.0
Posts: 104

Rep: Reputation: 15
Question 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....
 
Old 03-17-2006, 10:44 PM   #2
rajtendulkar
Member
 
Registered: Mar 2006
Posts: 34

Rep: Reputation: 15
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;
} MSG_TYPE;

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...

Raj
 
Old 03-19-2006, 08:12 AM   #3
sachitha
Member
 
Registered: Aug 2003
Location: Sri Lanka
Distribution: Redhat 9.0
Posts: 104

Original Poster
Rep: Reputation: 15
Thank you.. !
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
POSIX message queues(Solaris) to SYS V message queues(Linux) devershetty Programming 1 01-22-2007 11:15 AM
Posix Message queues? gdipierro Programming 20 07-26-2005 05:59 PM
Message Queues rag_mg Programming 1 05-08-2005 09:00 AM
POSIX message queues... infamous41md Programming 6 05-25-2004 03:53 PM
Message Queues BoldKiller Programming 1 05-28-2003 06:40 PM


All times are GMT -5. The time now is 09:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration