[cs631apue] [CS631] doubt on dup2

Jeevanandha Ramanathan jramana1 at stevens.edu
Mon Nov 6 14:41:53 EST 2017


Hi guys,

I am experimenting with the dup2. I have attached my code.

I am trying the dup the stdout to a file. But, the output is not as
expected.

I am not getting the output redirected to the file. Instead it's just
printing on the screen.

I assume the STDOUT_FILENO is a constant, which explains the behaviour of
the code. But, can someone tell me, what changes should be done to get the
output redirected to the file.


-- 
Thank you.

Kind regards,
Jeeva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20171106/2a92dc93/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dupdemo2.c
Type: text/x-csrc
Size: 567 bytes
Desc: not available
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20171106/2a92dc93/attachment.bin>


More information about the cs631apue mailing list