delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/15/17:20:12

From: "Edmund Horner" <ejrh AT paradise DOT net DOT nz>
Newsgroups: comp.os.msdos.djgpp
References: <8iap4s$s5d$1 AT nnrp1 DOT deja DOT com>
Subject: Re: File handling / argument globbing
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4029.2901
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4029.2901
Organization: Paradise Net Ltd. Customer
Message-ID: <961083116.597067@shelley.paradise.net.nz>
Cache-Post-Path: shelley.paradise.net.nz!unknown AT 203-79-93-29 DOT tnt11 DOT paradise DOT net DOT nz
X-Cache: nntpcache 2.4.0b2 (see http://www.nntpcache.org/)
Date: Fri, 16 Jun 2000 03:38:55 +1200
NNTP-Posting-Host: 203.96.152.26
X-Complaints-To: newsadmin AT xtra DOT co DOT nz
X-Trace: news.xtra.co.nz 961083133 203.96.152.26 (Fri, 16 Jun 2000 03:32:13 NZST)
NNTP-Posting-Date: Fri, 16 Jun 2000 03:32:13 NZST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

> How do I get to know long filename's short (8+3) -name?

I had this very same problem, which I solved after searching through the
findfirst() source.  Here's the little file I used.  I hope it's useful or
at least points you in the right direction.

Unfortunately I can't remember what the 'pathlen' argument means, but I
guess that it is the size of the 'pathname' argument given to findfirst() --
ie: strlen (pathname) + 1.

/*
    getdosname.c - This little function will get the 8.3 format DOS name
    immediately after a call to findfirst() or findnext().

    Warning: some very dirty tricks are used in this file.

    Copyright (C) 2000, Edmund Horner.
*/

#include <dir.h>
#include <go32.h>

int getdosname (char *dest, int pathlen)
{
 struct ffblklfn temp;

 dosmemget (__tb+pathlen, sizeof (struct ffblklfn), &temp);

    strcpy (dest, temp.fd_name);

    return 1;
}



- Raw text -


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