delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/26/02:24:30

From: Christopher Heng <cyfhsite!chris>
Subject: Re: Library problems
To: Eric Backus <ericb AT lsid DOT hp DOT com>
Date: Thu, 26 May 1994 12:07:10 +0800 (SST)
Cc: djgpp <djgpp AT sun DOT soe DOT clarkson DOT edu>
Reply-To: chris%cyfhsite AT csar DOT csah DOT com

In a previous message, Eric Backus wrote:
> 
> One way to make fstat() and stat() consistant would be to have fstat()
> call stat().  There must be some way to ask DOS for the pathname
> associated with the file pointer that fstat() gets, but I'm not a DOS
> expert so I don't know how to do that.

There's no easy documented way to do this. The undocumented way to do this
is to look up the file handle in the undocumented DOS system file table.
That'll yield only the filename (without path prefix). Getting a complete
pathname is even a greater pain. Probably involves getting the cluster
number stored in the DOS internal system file table, and presumably going
through each directory entry (starting from the root?) and comparing
name/cluster. (ugh!)

Doesn't seem worth it (or even reliable for that matter).

Regards,

Chris Heng.

-- 
+-------------------+-----------------------------------+
| Christopher Heng  | Internet: chris%cyfhsite AT csah DOT com |
| Singapore         |           csah.com!cyfhsite!chris |
+-------------------+-----------------------------------+

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019