Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> How to get each file name from a Unix dir in filename (not I-node) order.
I have a program (Pro*C) that loops through each file in a directory, but I want it get each file in filename order.
I find that the program below does it in i-node order (due to the way "readdir" works), which is usually but not always the same as filename order.
Can anyone help me?
strcpy(sDirName, "/u04/users/fe/CASES_load");
if ((dp = opendir(sDirName)) == NULL)
{ exit(EXIT_FAILURE); }
while ((direntp = readdir(dp)) != NULL)
{
/* Get file name */
sprintf((char *) sFileName, "%s", direntp->d_name);
}
closedir(dp);
}
Alister Miller
(E-mail preferred. Remove "nospam" for return e-mail) Received on Fri Sep 18 1998 - 00:00:00 CDT