dup Questions

5

Solved

In this C program #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> int main() { int file = open("Result", O_CREAT|O_WRONLY, S_IRWXU)...
Adda asked 25/6, 2012 at 12:33

4

Solved

I am writing some tests using Test::More, and one of the functions I'm testing prints to STDERR. I'd like to test the output to STDERR, but am a little unsure how to do this. I know I'm close. This...
Fideliafidelio asked 20/8, 2013 at 18:44

4

Solved

I am trying to redirect STDOUT AND STDERR to a socket. I did: if(fork() == 0) { dup2(newsock, STDOUT_FILENO); dup2(newsock, STDERR_FILENO); execvp(); } Somehow, it only showed the first litt...
Offer asked 11/11, 2011 at 22:36

3

Solved

I want to execute a program in a python application, it will run in the background but eventually come to the foreground. A GUI is used to interact with it. But controls are offered via a console...
Mae asked 9/2, 2012 at 12:54

2

Solved

I am stuck in this error for quite sometime now and have hit a dead end. I get this totally unhelpful error can't dup NilClass This is the situation. I have one class which is in a relationsh...
Wadley asked 19/7, 2010 at 6:17

6

Solved

The Ruby docs for dup say: In general, clone and dup may have different semantics in descendent classes. While clone is used to duplicate an object, including its internal state, dup typically u...
Pomelo asked 17/4, 2012 at 0:8

8

Solved

I know that dup, dup2, dup3 "create a copy of the file descriptor oldfd"(from man pages). However I can't digest it. As I know file descriptors are just numbers to keep track of file locations and...
Contrarious asked 22/10, 2011 at 18:12

5

Solved

I know what dup / dup2 does, but I have no idea when it would be used. Any practical examples?
Schlimazel asked 12/11, 2009 at 7:33

2

Solved

I'm working on a linux C project and I'm having trouble working with file descriptors. I have an orphan file descriptor (the file was open()'d then unlink()'d but the fd is still good) that has wr...
Schade asked 9/1, 2011 at 3:29

5

Solved

I have a hash like: h = {'name' => 'sayuj', 'age' => 22, 'project' => {'project_name' => 'abc', 'duration' => 'prq'}} I need a dup of this hash, the change should not affect...
Tymes asked 3/1, 2012 at 10:12

6

Solved

arr = ["red","green","yellow"] arr2 = arr.clone arr2[0].replace("blue") puts arr.inspect puts arr2.inspect produces: ["blue", "green", "yellow"] ["blue", "green", "yellow"] Is there anyway t...
Rheumatism asked 5/4, 2010 at 17:32

3

Solved

I have an object of a class, and I want to duplicate it with dup. One of the instance variables is an array, and it seems to be referencing it. I thought dup actually created a DUPLICATE. Here's m...
Averett asked 1/1, 2012 at 2:4

2

Solved

Can I get a really dumbed down explanation of the dup() function when it comes for duplicating file descriptors? I want to use pipe, but I have to also make the child to read from pipe(this is the ...
Georgiegeorgina asked 27/10, 2015 at 22:25

2

Solved

What's the difference between Ruby's dup and clone methods? describes the difference in the behavior of dup and clone. But when should I use dup, and when should I use clone instead? Examp...
Inverson asked 1/8, 2012 at 0:0

1

Currently I'm coding a small shell (redirection, pipes, exec, etc.). Been trying to figure out the steps the Linux shell takes in addressing I/O redirection. Some questions on what I need help on:...
Faline asked 26/11, 2013 at 11:8

1

Solved

I have an assignment I'm working on and I'm having difficulty finishing it. The idea is to write a program if.c that executes one program and if that succeeds it executes the second program. I'm su...
Gomez asked 13/2, 2013 at 5:11

1

Solved

I have a Pointer class with a single attribute :contents, that points to an object of class MyObject. class MyObject def hello; "hello" end end class Pointer attr_reader :contents def initiali...
Cotten asked 14/8, 2012 at 2:55

1

I am trying to set up arbitrary pipelines from Perl, in much the same way as a shell might. This has the desired effect, it's like "echo foo | sed s/oo/ar/": #!/usr/bin/perl use strict; use IO::...
Orosco asked 24/7, 2012 at 23:20

1

Solved

This is a follow up question from here. Where I want do go I would like to be able to temporarily redirect the stdout into a temp file, while python still is able to print to stdout. This would in...
Tswana asked 11/1, 2012 at 10:50

3

Solved

This is a follow up question from here specifically concerning its answer. From a python module I am calling a Hello World executable that simply prints Hello World to the stdout. I am intereste...
Copaiba asked 10/1, 2012 at 14:32
1

© 2022 - 2024 — McMap. All rights reserved.