is it possible to duplicate file descriptors(opened by a different process) with the help of dup or dup2. the two process do not share parent child relationship as well.
I have a parent process which the user might have set its std (out / err) to a specific file (fd).
I want the child process to have the same std(out / err) as the parent.
Recently I'm studying linux inter process communication. But I have some problems in understanding the pipe mechanism.
I know that pipe is a pair of files created by parent process, then the parent process passes the file descriptors to its child process then child process can operate on it.