Dot files always first in directory?

Jonathan I. Kamens jik at athena.mit.edu
Thu May 4 23:31:57 AEST 1989


It it safe to assume when writing a program which manipulates
directories that . and .. will always be the first two entries in a
directory?

If I can't assume that, then I've got to compare every file in the
directory to "." and "..", and this would probably slow the program
down even more than it already is.

As it is now, I'm just doing

	readdir(dirp); readdir(dirp); /* get rid of . and .. */

in my code right after the opendir().  Is this valid?

Jonathan Kamens			              USnail:
MIT Project Athena				410 Memorial Drive, No. 223F
jik at Athena.MIT.EDU				Cambridge, MA 02139-4318
Office: 617-253-4261			      Home: 617-225-8218



More information about the Comp.unix.wizards mailing list