Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello Sir/friends,
i have a small problem here that i have written a c++ program which will write a structure of some data into message queue, but i have a task to create and read that from queue in perl script. the problem is i m not getting how to read structure data in perl process because in perl there is no method to define structure .plz if any one know the solution
thanks in advance.
Do you mean you've got to pass data from a C++ programme to a perl programme?
If so, then you could either look into sockets (to communicate directly between the programmes) or just get the C++ programme to write its data to a file, and then have the Perl programme read it from that file.
ya like that we can do but here i m running both c++ and perl process in single server and my sir has suggested to use Message Queue only....
That data is in structure format like struct data{ type1 data1,type2 data2,...};
this structure i can easily write in queue using msgsnd(queueId,$data,sizeof(data),type,flag)function and i can easily read it from queue using msgrcv(queueId,$data,sizeof(data),type,flag) and i can extract each data using its object like obj.data1,obj.data2 etc (just example). . but in perl process there is no concept called structure so if i want to read such kind of data from queue in perl process how can i do that. plz share if you have any idea.
If I understand you correctly, you want the unpack function. The data you're going to be getting with Perl is just a string of bytes, and you need to tell Perl what data types etc. they are, so it can work out what they mean.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.