Path: utzoo!attcan!uunet!aplcen!samsung!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!hplabs!hpfcso!hpfcdc!donn From: donn@hpfcdc.HP.COM (Donn Terry) Newsgroups: comp.sys.hp Subject: Re: DIRECTORY (3C) strangeness Message-ID: <5570332@hpfcdc.HP.COM> Date: 25 Nov 89 05:10:50 GMT References: <616@mmlai.UUCP> Organization: HP Ft. Collins, Co. Lines: 18 (Almost?) all UNIX systems, not just HP-UX, return the directory enties in unspecified order. (The actual order is a function of the order in which the entries were created (and removed) and of the length of the entries if you are using long file names.) The simplest (although not the most efficient in terms of system resources) solution to get what you want would be foo = popen("ls", "r"); and do freads from foo to get the names. You could read them all with readdir() and use qsort(), or copy them to an ordinary file and use the sort command via system(). Donn Terry HP Ft. Collins (No, I'm not speaking officially for HP, or anyone else for that matter.)