The UNIX and Linux Forums
>
Top Forums
>
High Level Programming
Changing stdin from file redirection to console input
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Changing stdin from file redirection to console input
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
4
(
permalink
)
09-29-2001
rwb1959
Registered User
Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
When a program is loaded by the OS,
it is automatically given 3 open files...
stdin -> fd=0
stdout -> fd=1
stderr -> fd=2
By closing all fd's you guarantee that
the next file you open...
open(...)
...will be assigned fd 0
rwb1959
View Public Profile
Visit rwb1959's homepage!
Find all posts by rwb1959
Find rwb1959's past nominations received
Find rwb1959's present nominations given