C/C++ on Linux/Unix

Moderators: Lundin
Number of threads: 336
Number of posts: 663

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
why use dup? (not dup2) Posted by Josh Code on 13 May 2009 at 7:45 AM
Why would anyone use the unix/linux dup function?

I know that dup2 is useful but I'm confused about why someone use a function that seems to just return another number for the same job.

Why do we care if the file descriptor is the smallest available? We will store the value in a variable anyway. It seems like it might aswell be any int value.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.