The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Purpose of 2>&1 in the command mmunir Shell Programming and Scripting 1 05-27-2008 05:00 AM
OPeNDAP 3.8.5 (General-Purpose Handlers branch) iBot Software Releases - RSS News 0 04-26-2008 05:20 PM
whats the purpose of the following script? vrn UNIX for Dummies Questions & Answers 1 03-20-2006 09:15 PM
Purpose of lint in UNIX kumar_saurabh UNIX for Dummies Questions & Answers 1 09-25-2005 10:10 AM
Looking for a general purpose System Monitor darthur UNIX for Dummies Questions & Answers 5 04-09-2002 04:12 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-11-2005
Yifan_Guo Yifan_Guo is offline
Registered User
  
 

Join Date: Mar 2005
Posts: 10
Understanding the purpose of dup/dup2

I'm having difficulty understanding the purposes of using dup/dup2 when involving forks.

for example, if we call fork() once, that is, we are creating a child process. In what cases would we need to use dup or dup2 to duplicate the file descriptors for standard output and standard error? What happens if we don't do this?

also, what is meant by the following:

"This function starts the child process, redirects the standard output and standard error to the log file (logfile)"

What is this redirection?

Please be as specific as you can please. Thank you very much.

Last edited by Yifan_Guo; 03-11-2005 at 06:49 PM..
  #2 (permalink)  
Old 03-13-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
See this thread. The last 2 posts in the thread are discussing redirection.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0