Is there a standard way of sending floating point values from a child process to a parent process in C.
I have a some calculations where I want to fork a process, then have the child do some busy work, the parent do something else, and then the child send its values (which are doubles) back to the parent (presumably through a pipe). Clearly the parent could parse the stream, but I’m just wondering if there’s a cleaner way?
If you’re just sending them between two processes on the same machine, there’s no need to get fancy. On the sending side:
And on the receiving side:
You should check the return values of
writeandreadof course.