473,395 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Given a file pointer is there any way to get the fill path to thefile

I tried unistd.h
but nothing much
Oct 3 '08 #1
11 1833
pa********@hotmail.com wrote:
I tried unistd.h
but nothing much
Tried what? Ah, I see you hid your question in the subject line.

This topic has been done to death here several times, check the archives.

--
Ian Collins.
Oct 3 '08 #2
pa********@hotmail.com wrote:
I tried unistd.h
but nothing much
(Please put your question in the body of your message, and use
the Subject line as a "title" or "motto" for the discussion. Don't
rely on Subject to carry the whole load.)

This is Question 19.15 in the comp.lang.c Frequently Asked
Questions (FAQ) list, <http://www.c-faq.com/>, and you're not
going to like the answer.

--
Er*********@sun.com
Oct 3 '08 #3
"pa********@hotmail.com" <pa********@hotmail.comwrites:
I tried unistd.h
but nothing much
Please put the question:

Given a file pointer is there any way to get the fill path to the
file

in the body of your message.

There is no way in standard C to do this, unless you remember the file
name when you open it. The reference to unistd.h implies that you're
using a Unix-like system; I don't believe there's any direct way to do
this under Unix either, but if there is you'll get better answers in
comp.unix.programmer (check their FAQ(s) first).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 3 '08 #4
On Oct 3, 11:29 pm, Keith Thompson <ks...@mib.orgwrote:
<snip>
The reference to unistd.h implies that you're
using a Unix-like system; I don't believe there's any direct way to do
this under Unix either, but if there is you'll get better answers in
comp.unix.programmer (check their FAQ(s) first).
I've asked before, they don't have one :-(
It'd be helpful.
Oct 3 '08 #5
pa********@hotmail.com <pa********@hotmail.comwrote:
I tried unistd.h
but nothing much
It would be helpful if you actually stated your question (how to get a
file name from a file pointer) in the text rather than just in the
subject.

On many systems, there is no unique mapping between file names and
files; there can be zero, one, or many names for a file. There is no
function either in standard C or in Posix to do that.
--
Larry Jones

Mom would be a lot more fun if she was a little more gullible. -- Calvin
Oct 3 '08 #6
vi******@gmail.com writes:
On Oct 3, 11:29 pm, Keith Thompson <ks...@mib.orgwrote:
<snip>
>The reference to unistd.h implies that you're
using a Unix-like system; I don't believe there's any direct way to do
this under Unix either, but if there is you'll get better answers in
comp.unix.programmer (check their FAQ(s) first).

I've asked before, they don't have one :-(
It'd be helpful.
A Unix FAQ is posted regularly to comp.unix.questions and
comp.unix.shell. See, for example,
<http://www.faqs.org/faqs/unix-faq/faq/>. Question 4.3 is "How do I
find the name of an open file?". (The answer was written 15 years
ago, but I don't think anything has changed.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 4 '08 #7
On Oct 4, 2:26*am, vipps...@gmail.com wrote:
On Oct 3, 11:29 pm, Keith Thompson <ks...@mib.orgwrote:
<snip>
The reference to unistd.h implies that you're
using a Unix-like system; I don't believe there's any direct way to do
this under Unix either, but if there is you'll get better answers in
comp.unix.programmer (check their FAQ(s) first).

I've asked before, they don't have one :-(
It'd be helpful.
A small question ,
where can I find the archives and is there a direct search to the same
Oct 4 '08 #8
"pa********@hotmail.com" <pa********@hotmail.comwrites:
On Oct 4, 2:26*am, vipps...@gmail.com wrote:
>On Oct 3, 11:29 pm, Keith Thompson <ks...@mib.orgwrote:
<snip>
The reference to unistd.h implies that you're
using a Unix-like system; I don't believe there's any direct way to do
this under Unix either, but if there is you'll get better answers in
comp.unix.programmer (check their FAQ(s) first).

I've asked before, they don't have one :-(
It'd be helpful.

A small question ,
where can I find the archives and is there a direct search to the same
Um, which archives? groups.google.com archives most Usenet posts.
www.faqs.org archives frequently asked questions list, though not in a
particularly reader-friendly format. I found the Unix FAQ by a simple
Google search for "Unix FAQ".

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 4 '08 #9
pa********@hotmail.com wrote, On 04/10/08 18:17:
On Oct 4, 2:26 am, vipps...@gmail.com wrote:
>On Oct 3, 11:29 pm, Keith Thompson <ks...@mib.orgwrote:
<snip>
>>comp.unix.programmer (check their FAQ(s) first).
I've asked before, they don't have one :-(
It'd be helpful.

A small question ,
where can I find the archives and is there a direct search to the same
Google Groups, through which you are posting, acts as an archive and
allows you to search! There are, I believe, other places that also
archive some groups. However, News Groups are not a centralised thing so
there is no one definitive archive (although Google tries to be one).
--
Flash Gordon
If spamming me sent it to sm**@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
Oct 4 '08 #10
On Oct 4, 1:21*am, Keith Thompson <ks...@mib.orgwrote:
A Unix FAQ is posted regularly to comp.unix.questions and
comp.unix.shell. *See, for example,
<http://www.faqs.org/faqs/unix-faq/faq/>. *Question 4.3 is "How do I
find the name of an open file?". *(The answer was written 15 years
ago, but I don't think anything has changed.)
Well, something has changed. From the answer: "Just realize that
searching a 600 megabyte filesystem for a file that may not even exist
is going to take some time." Filesystems with only 600 megabyte are
hard to find nowadays :-)
Oct 6 '08 #11
>Well, something has changed. From the answer: "Just realize that
>searching a 600 megabyte filesystem for a file that may not even exist
is going to take some time."
Searching for the file on a 1TB filesystem will be even slower.
>Filesystems with only 600 megabyte are
hard to find nowadays :-)
I disagree. CD-ROMs are limited to about 700 megabytes and it's not
uncommon to use less than that for smaller distributions.

It's true that *disk drives* and more recently *memory sticks* with
only 600 megabytes are hard to find. However, disks can be
partitioned, and a filesystem fits on one partition. There are
advantages to having a small root filesystem (say, 200MB, 50% full)
on UNIX: it's written to infrequently (except during system
upgrades), so the chances of corruption due to power failure or
accidental reset are low. Incremental backups are small. Filesystem
checks are faster. There is likely to be little or no user-owned
data on it. (It's assumed that such filesystems as /usr, /var,
/tmp, /usr/local, and /home are on mounted filesystems). Restoring
a root filesystem is a bit painful but it's less painful if the
backup is on one CD/DVD or memory stick.

Oct 6 '08 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
4
by: Christian Galbavy | last post by:
Hello! My friend and I are working on a little program. It sends a local file to a server (php), we use the rfc1867 protocoll for this. When the server gets the data, it replies with some...
2
by: Jamie A. Landers | last post by:
I have a macro that runs to export a report. It dumps a report on the server in RTF format. Here's the problem that I am having. I would like for the report to have a custom file name daily, like...
2
by: David | last post by:
I'm using following code for checking a file existence. I's working fine for given folder. Is there a way to check a file exitance in subfolders? Thanks in advance, David Option Compare...
13
by: DC Gringo | last post by:
How do I test for existence of a file in the file system: If FileExists(myVariable & ".pdf") = True pnlMyPanel.Visible = True End If -- _____ DC G
5
by: IcingDeath via DotNetMonster.com | last post by:
I am building this SQL Server database app in which i can store files. In order to display files I want to have the app show the associated icon for the extension of the file that is in the...
7
by: utab | last post by:
Hi there, I am trying to read from a file and at the same time change certain fields of the same field, there are 6 fields in this file like 1 2 3 4 5 6...
7
by: nergal | last post by:
Hi, I've been staring myself blind on the same little code now and I cant see the problem. The filepointer seems to not change when I open it in a function. I've written like this (a bit pseudo...
3
by: rullbandspelare | last post by:
I have a directory that contains images wich are displayed with this code: (All it does, is going through all the images in the directory and displays them). <?php function...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.