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
Find and store files based on FileName and Modified Time edisonantus UNIX for Advanced & Expert Users 2 02-19-2008 10:25 AM
find formatted filename with date time dpath2o UNIX for Advanced & Expert Users 6 02-05-2008 07:20 PM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 02:38 PM
find filename based on file content kollerj UNIX for Dummies Questions & Answers 4 06-02-2001 10:31 AM
search for hardlinks based on filename via find command hunternjb UNIX for Dummies Questions & Answers 2 03-26-2001 09:07 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2007
Registered User
 

Join Date: Oct 2004
Posts: 215
help to find find filename usingFile pointer in c

Hi ..

I am having a file pointer .. it have declared some where tough to find out that ..Can we find out the filename associated with file pointer ...

i mean is there any function FILEPOINTER.filename() is there in c ??...

Thanks,
Arun
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-07-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,323
Not AFAIK. You cannot find the filename from a file pointer or a file descriptor. This has been discussed here before. You can search the site for more info.
Reply With Quote
  #3 (permalink)  
Old 08-07-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,354
In the case of "prog_a | prog_b", prog_b won't have any name associated with FD 0. There are lots of problems like that. lsof is a program that can display pretty good info for most FD's of most processes, but it must run suid'ed to root. Get lsof and run it to see if that sort of info could help you. If so, use popen() to run lsof from your process and parse the lsof output to get what you need. Something like this is the only way.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:21 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0