File listing for current directory under Unix?

mike.stefanik mike at bria.UUCP
Fri May 10 07:30:16 AEST 1991


In an article, gordon at osiris.cso.uiuc.edu (John Gordon) writes:
>marekp at pnet91.cts.com (Marek Pawlowski) writes:
>
>>Does anyone know of a way to get the filenames of the files in the current
>>directory, in to a two dimensional array of sorts?
>
>	Yes.  do a:    popen("ls *", "r");

Actually, this will only work on UNIX-based systems, or perhaps DOS that
has MKS tools or a facsimile thereof.

Generally, this is operating system dependant and therefore the question
is best posted for the particular os in question.

As an aside, the use of popen() for this purpose is rather ungainly.  Using
readdir() would have been a better suggestion.

-- 
Michael Stefanik, MGI Inc, Los Angeles | Opinions stated are never realistic
Title of the week: Systems Engineer    | UUCP: ...!uunet!bria!mike
-------------------------------------------------------------------------------
If MS-DOS didn't exist, who would UNIX programmers have to make fun of?



More information about the Comp.lang.c mailing list