Cheat sheet for opendir()

John Esak john at valar.com
Tue Dec 1 07:28:15 PST 2009


Ahh, good picking... It just shows how you can fool yourself with bad
testing.  Before I posted that, I tested on both Unix and Windows. On Unix I
used a directory called /tmp/test which I made for the purpose of the test.
Then, Windows I made a directory called c:\test and ran the same opendir(),
it of course returned "." and "..".  Never thought about opening a root
folder.  Thanks.

John

> -----Original Message-----
> From: Kenneth Brody [mailto:kenbrody at spamcop.net] 
> Sent: Tuesday, December 01, 2009 10:19 AM
> To: john at valar.com
> Cc: filepro-list at lists.celestial.com
> Subject: Re: Cheat sheet for opendir()
> 
> John Esak wrote:
> [...]
> > Here comes some of the hinty things.  If you ask for 
> *every* file in a
> > directory, opendir() will always find at least two (2) 
> files.  You will not
> > usually find n to be equal to zero even in an empty 
> directory.  That is
> > because there are always two files in any folder 
> represented by "." and
> > "..".
> [...]
> 
> Thanks for the informative post.  However, I have one nit to 
> pick.  On 
> Windows filesystems, there are no "." and ".." entries in the 
> root directory.
> 
> -- 
> Kenneth Brody
> 



More information about the Filepro-list mailing list