TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Gautam Lad
from: Henk den Adel
date: 1996-12-15 15:50:30
subject: DosFindFirst

Hi Gautam,

You asked for it:

 GL> By any chance is DosFindFirst supposed to return directories upon search?

Yes, it does, no, not immediately. See for yourself:

Compile it with BCC4OS2 1.+

#include 
#include 
#include 
#include 

#define FILE_BLOK   struct ffblk

main()
{
 FILE_BLOK strukkie;

 if ( findfirst("*.*", &strukkie, FA_DIREC | FA_HIDDEN) == 0
&&   (strukkie.ff_attrib & FA_DIREC ) != 0 )
      printf("Dir: %s\n", strukkie.ff_name);
 else
      return 0;

 while (findnext(&strukkie) == 0 && (strukkie.ff_attrib &
FA_DIREC ) != 0 )
      printf("Dir: %s\n", strukkie.ff_name);

 return 0;

}

The tric is that you have to check whether it's a directory by masking the attribute.


Cu,
 Henk

--- GoldED 2.50+
* Origin: Henks Toolbox, Mail only, +31 10 220 54 61 (2:286/415)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1
@PATH: 286/415 4 700 280/801 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™.