www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/31/09:09:54

Date: Mon, 31 May 1999 16:07:30 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "K.C. Adams" <kadams AT apk DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: LFN vs Short(8.3) file names
In-Reply-To: <MPG.11bc3b9944958784989684@news.apk.net>
Message-ID: <Pine.SUN.3.91.990531155707.6693A-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 31 May 1999, K.C. Adams wrote:

> Trying to write a little commandline utility under windows 95.  I need to 
> access the dos (short/8.3) filename as well as the windows LFN.

One way is simply to push "LFN=n" into the environment (e.g. by calling 
`putenv' library function), then call any file-oriented function you 
want.  When you need the long name again, push "LFN=y" into the 
environment and call the same function to get the long name.

Alternatively, you could use a special function of Interrupt 21h provided
by Windows for this (DJGPP library uses it internally when you call
`system' or `spawnXX' functions).  Here's an untested fragment that should
do what you want: 

  __dpmi_regs r;
  char short_name[FILENAME_MAX], long_name[FILENAME_MAX];

  _put_path (long_name);
  r.x.ax = 0x7160;
  r.x.cx = 1;
  r.x.ds = r.x.es = __tb / 16;
  r.x.si = r.x.di = __tb & 15
  __dpmi_int(0x21, &r);
  if (r.x.flags & 1)
    /* error return */
  else
    dosmemget(__tb, FILENAME_MAX, short_name);

- Raw text -


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