Top "Dup" questions

dup() is a c system call that duplicates a file descriptor

practical examples use dup or dup2

I know what dup / dup2 does, but I have no idea when it would be used. Any practical examples? Thanks.

c file unix system-calls dup
What's the difference between Ruby's dup and clone methods?

The Ruby docs for dup say: In general, clone and dup may have different semantics in descendent classes. While clone …

ruby clone dup
Can someone explain what dup() in C does?

I know that dup, dup2, dup3 "create a copy of the file descriptor oldfd"(from man pages). However I can't …

c pipe dup2 dup
How to redirect the output of system() to a file?

In this C program #include <stdio.h> #include <fcntl.h> int main() { int file = open("Result", …

c linux system stdout dup
Duplicating a Ruby array of strings

arr = ["red","green","yellow"] arr2 = arr.clone arr2[0].replace("blue") puts arr.inspect puts arr2.inspect produces: ["blue", "green", "yellow"] ["…

ruby arrays copy clone dup
In C, how do I redirect STDOUT_FILENO to /dev/null using dup2 and then redirect back to its original value later?

I have an assignment I'm working on and I'm having difficulty finishing it. The idea is to write a program …

c fork stdout dup2 dup
Redirect STDOUT and STDERR to socket in C?

I am trying to redirect STDOUT AND STDERR to a socket. I did: if(fork() == 0) { dup2(newsock, STDOUT_FILENO); dup2(…

c bash shell stdout dup
can't dup NilClass - Error

I am stuck in this error for quite sometime now and have hit a dead end. I get this totally …

ruby-on-rails ruby dup
Python: fork, pipe and exec

I want to execute a program in a python application, it will run in the background but eventually come to …

python exec fork stdio dup
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