List a directory in a C program on Unix machines

Chris Torek chris at mimsy.umd.edu
Mon Aug 13 08:57:38 AEST 1990


(Given the subject, why is this in comp.lang.c?  Why the usa
distribution?  I am moving it to comp.unix.questions, although I
anticipate no further comments.)

In article <159 at smds.UUCP> rh at smds.UUCP (Richard Harter) writes:
[re opendir/readdir/closedir]
>But be warned.  There are some portability pitfalls so the routine to
>fetch the file names should be encapsulated.  The major variants that
>I can think of offhand are:
>
>(a)	BSD	Uses <sys/dir.h> 
>(b)	SYS V	Uses <dirent.h>

POSIX says <dirent.h>; 4.3BSD-Reno and later systems thus use <dirent.h>.

>(c)	SYS V	Older versions of SYS V may not have these routines.
>		You can write your own. ...

Or use Doug Gwyn's version of Kirk McKusick's version of these routines.

[other systems deleted]
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris
	(New campus phone system, active sometime soon: +1 301 405 2750)



More information about the Comp.unix.questions mailing list