Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hello,
Can anyone give an example or related web link for alternatives of C functions like sscanf(), memset() for passing data from child to parent process in C++. More precisely I want to pass user defined types from child to parent and vice-versa.

Thanks in advance.

Regards,
Usman
Posted
Comments
Sergey Alexandrovich Kryukov 14-Jul-12 23:00pm    
How sscanf or memset can be related to the problem of passing data between processes? :-)
What is your platform?
--SA

1 solution

Please see my comment to the question. One very universal way of passing data between processes is using sockets; and, with C++, such solution can be multiplatform. Don't think that sockets are used only for networking. Historically, socket API was develop as IPC (Inter-Process Communication).

The second universal method is using named pipes. Another one is the shared memory block.

Please see:
http://en.wikipedia.org/wiki/Network_socket[^],
http://en.wikipedia.org/wiki/Unix_domain_socket[^],
http://en.wikipedia.org/wiki/Berkeley_sockets[^],
http://en.wikipedia.org/wiki/Named_pipe[^],
http://en.wikipedia.org/wiki/Shared_memory[^].

For more information on IPC, please see:
http://en.wikipedia.org/wiki/Inter-process_communication[^].

You could get more specific references and advice is you shared more information on your platforms, the goal of the communications between processes and your requirements. Some detail could be not so important, but not tagging your platform and not explaining your goals… this is too much of uncertainty. However, the information referenced above is good enough to get basic ideas; so you can start with them to understand what you really need.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900