www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/27/14:24:43

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: Re: Library problems
To: wozzle!alane AT imageek DOT york DOT cuny DOT edu
Date: Fri, 27 May 94 10:44:06 PDT
Cc: imageek!cyfhsite!chris AT omnigate DOT clarkson DOT edu, djgpp AT sun DOT soe DOT clarkson DOT edu
Mailer: Elm [revision: 70.85]

J. Alan Eldridge (alane AT wozzle DOT linet DOT org) wrote:
> > 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
> 
> Here's how to do it in real mode. Protected mode is left as an exercise
> for the reader :)

(code deleted)

> To see how this works, just type 'truename somefile' at any DOS prompt
> (where DOS is version 5.x or higher). It's built into command.com,
> although that isn't documented either <sigh>.


Maybe I'm missing something here.  Truename takes as argument a
filename, with no path attached, right?  But fstat() doesn't have a
filename.  All it has is a handle, which is an integer.  Somewhere in
the bowels of DOS, that number corresponds to an open file, whose name
(including path) we need if we want to call stat().

I don't see how truename solves this problem.
--
				Eric Backus
				ericb AT lsid DOT hp DOT com
				(206) 335-2495

- Raw text -


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