The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Passing a file descriptor robotball Shell Programming and Scripting 6 06-08-2008 11:41 PM
File descriptor constant vino High Level Programming 4 05-18-2005 02:18 AM
Problems with file descriptor teo High Level Programming 11 05-09-2005 12:47 PM
file activity (open/closed) file descriptor info using KORN shell scripting Gary Dunn UNIX for Dummies Questions & Answers 3 06-07-2004 02:54 PM
bad file descriptor? ftb UNIX for Dummies Questions & Answers 1 02-20-2002 07:19 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 10-14-2004
rahulrathod rahulrathod is offline
Registered User
  
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 158
Question File Descriptor Help

What is a file descriptor in Unix??

How to find a file descriptor of a file in Unix??

Does it have anything to do with the Inode numbers??
  #2 (permalink)  
Old 10-14-2004
arunkumar_mca arunkumar_mca is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 256
file

Rathore
u c an use stat structure and find it
arun
  #3 (permalink)  
Old 10-14-2004
rahulrathod rahulrathod is offline
Registered User
  
 

Join Date: Sep 2004
Location: Mumbai-India
Posts: 158
Mr Arun Thanks for ur reply.

But i dint get it still.

Where is this stat structure located. Is it a command.
If it is it does n't run in SCO unix.

if it is a file where is it located.
  #4 (permalink)  
Old 10-14-2004
google's Avatar
google google is offline Forum Advisor  
Moderator
  
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
If you are familiar with UNIX I/O redirection, syntax similar to the following should not be new to you:
command > file 2>&1
When command runs it sends "normal" output to file, and any error messages generated by command are also written to file. "2>&1" handles the latter.

The 2 and 1 are file descriptors. So what's a file descriptor?

When a UNIX program wants to use a file, it must first open that file. When it does so, UNIX will associate a number with the file. This number, which is used by the program when reading from and writing to the file, is the file descriptor.

A typical UNIX program will open three files when it starts. These files are:

- standard input (also known as stdin)
- standard output (also known as stdout)
- standard error (also known as stderr)

Standard input has a file descriptor of 0, standard output uses 1, and the number 2 is used by standard error.
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 11:11 AM.


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