directory handling in ansi C

overhead news at haddock.ima.isc.com
Wed Nov 22 07:55:42 AEST 1989


In article <13288 at s.ms.uky.edu> beech at ms.uky.edu (Wayne Beech) writes:
>Does anyone know the rationale behind not specifically defining a set of
>functions to work with directories in ansi C; things like opendir(),
>next_dir_entry(), isdir(), etc.  if you are writing a program that works
>with directories that is expected to run on unix and non-unix machines how
>do you handle this? with a bunch of #ifdef UNIX #elif SOMEOTHERMACHINE ....?

I would hope that UNIX and non-UNIX OSs would used the POSIX
semantics for this.  POSIX is a standard, and covers this issue.
The ANSI C document has a finite scope (as does any standard or
document of finite length).  Directory stuff is one of those
areas I now do without ifdefs.  Sometimes, I have to provide my
own directory library routines, implemented with what they gave
me, but more systems are being provided using the POSIX and ANSI
C guides.  This has been a help.

Stephen.



More information about the Comp.lang.c mailing list