| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

read_dir

#include "sfldir.h"
Bool
read_dir (
    DIRST *dir)

Synopsis

Reads the next entry from the directory stream. Returns TRUE if there was more data to read; returns FALSE if there was nothing more to read. Updates the fields in the directory structure when it returns TRUE. The strings in DIRST all point to static areas that may change after a further call to read_dir. If you need persistent data (i.e. because you want to collect a set of DIRSTs and then sort them, call fix dir() after each call to open_dir and read_dir. You should then call free dir() to release each DIRST when you are finished.

Source Code - (sfldir.c)

{
    ASSERT (dir != NULL);

#if (defined (__UNIX__) || defined (__VMS_XOPEN) || defined (__OS2__))
    if ((dir-> _dir_entry =
        (struct Dirent *) readdir (dir-> _dir_handle)) != NULL)
        return (populate_entry (dir));
    else

#elif (defined (WIN32))
    if (FindNextFile (dir-> _dir_handle, &dir-> _dir_entry))
        return (populate_entry (dir));
    else

#elif (defined (_MSC_VER))
    if (_dos_findnext (&dir-> _dir_entry) == 0)
        return (populate_entry (dir));
    else

#elif (defined (__TURBOC__) || defined (__DJGPP__))
    if (findnext (&dir-> _dir_entry) == 0)
        return (populate_entry (dir));
    else
#endif

    return (FALSE);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation