How to re-open a closed file descriptor

Posted by chaitu on Stack Overflow See other posts from Stack Overflow or by chaitu
Published on 2012-03-30T05:25:44Z Indexed on 2012/03/30 5:29 UTC
Read the original article Hit count: 119

Filed under:

I have a scenario where i created pipe for communication between two child and parent. Parent writes (using write function)data to the pipe and closes the respective file descriptor. The problem is when i want to write data again to the pipe, the write function is returning error code -1. I think its because writing end has been closed in previous iteration. Then how to open the corresponding file descriptor after it has been closed once.

I tried using open() function which requires path to some file as arguement. But i am not using any files in my application. I have simple file descriptors (int arr[2]).

Is it possible to achieve above scenario with pipes????

© Stack Overflow or respective owner