The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-07-2007
arunkumar_mca arunkumar_mca is offline
Registered User
  
 

Join Date: Oct 2004
Posts: 255
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
  #2 (permalink)  
Old 08-07-2007
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
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.
  #3 (permalink)  
Old 08-07-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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.
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 12:28 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