TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: James Beard
from: Doug Nazar
date: 1996-07-15 12:09:54
subject: MUST_HAVE_DIRECTORY

Hello James!

Thursday July 11 1996 17:02, James Beard wrote to All:

JB> DosFindFirst((PCSZ)&"*\0", &hDir,
JB>   MUST_HAVE_DIRECTORY, &FindBuf3,
JB>   sizeof(FILEFINDBUF3), &ulFileNames, FIL_STANDARD);

On the whole it looks ok except your first parameter to DosFindFirst. That
should be just "*".

Here's a quick sample I whipped up


-- CUT -------- Begin 1.cpp -------- CUT --
#define INCL_DOSFILEMGR
#include 

#include 

int main(int argc, char *argv[]) {
   char searchPath[CCHMAXPATH] = {0};
   char displayPath[CCHMAXPATH] = {0};

   if (argc==1)
      strcpy(searchPath, "*");
   else
      strcpy(searchPath, argv[1]);

   strcpy(displayPath, searchPath);

   char *temp = displayPath + strlen(displayPath);
   while ((temp >= displayPath) &&
          (*temp != '\\'))
      *temp-- = '\0';

   HDIR hDir = HDIR_CREATE;
   ULONG ulFileNames = 1;
   FILEFINDBUF3 FindBuf3 = {0};
   APIRET rc = 0;

   rc = DosFindFirst(searchPath, &hDir,
                     MUST_HAVE_DIRECTORY, &FindBuf3,
                     sizeof(FILEFINDBUF3), &ulFileNames, FIL_STANDARD);
   if (rc) {
      cerr << "DosFindFirst: " << rc << endl;
      return 2;
   }

   do {
      cout << displayPath << FindBuf3.achName << endl;

      rc = DosFindNext(hDir, &FindBuf3, sizeof(FILEFINDBUF3), &ulFileNames);
      if (rc) {
         cerr << "DosFindNext: " << rc << endl;
      }
   } while (!rc);

   DosFindClose(hDir);
   return 0;
}
-- CUT --------- End 1.cpp --------- CUT --

Doug

--- GoldED/2 2.50+
* Origin: Realm of the Dragons - `Where thy mind hath no limits' (1:250/516)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 517 624 628 713/888 800/1
@PATH: 250/516 101 99 3615/50 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.