fork() in c++
Hi all!
I'm trying to learn how to use fork() in linux as it is useful for a project I'm currently working on. My problem however is that I don't quite know how to allow the two separate processes from talking to each other, since they're memory spaces are recreated and hence are not shared. Is there anyway of allowing them to talk to each other, short of using files? Thanks! |
Check out the pipe() function. Open the pipe before you fork(), then the two processes can communicate via the pipe.
|
reading/ writing files, is also an option but I/O requests are slow.
I you still want to proceed with this, use fcntl to lock the files |
these tutorials will make your day: http://www.ecst.csuchico.edu/~beej/guide/
|
Thanks a bunch guys! Oh and Karlan, that site was great, thanks again!
|
i reccomend the sockets tutorial, networking programming is such fun
|
All times are GMT -5. The time now is 05:17 AM. |