Top "Dup2" questions

dup2() is a c system call that duplicates a file descriptor.

dup, dup2, tmpfile and stdout in python

This is a follow up question from here. Where I want do go I would like to be able to …

python stdout io-redirection dup2 dup
Are STDIN_FILENO and STDOUT_FILENO read only in c?

fd = open("/dev/null", O_RDWR); if (fd == -1) { ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "open(\"/dev/…

c unix file-descriptor dup2
How to use dup2/close correctly to connect these three processes?

I'm trying to properly connect three processes in order to allow inter-process communication between them. I have one process, scanner, …

c fork pipe dup2
Does this multiple pipes code in C makes sense?

I've created a question about this a few days. My solution is something in the lines of what was suggested …

c exec fork pipe dup2
Redirecting stdout to file after a fork()

I'm working on a simple shell, but right now I am just trying to understand redirection. I'm just hard coding …

file fork redirect stdout dup2
Understanding dup2 and closing file descriptors

I'm posting my code simply for context of my question. I'm not explicitly looking for you to help fix it, …

c++ linux dup2
Dining Philosophers in C using fork()

I wrote a C program for the Dining Philosophers Problem using pthread some time ago and am now trying to …

c fork semaphore dup2 dining-philosopher