Synesis Software

opendir()/readdir() API
[Synesis Software UNIX Emulation for Win32]


Detailed Description

This API provides facilities for enumerating the contents of directories.


Classes

struct  unixem_dirent
 Results structure for readdir(). More...
struct  unixem_wdirent
 Results structure for wreaddir(). More...

Defines

#define DIR   unixem_DIR
 Handle type for multibyte string directory enumeration.
#define wDIR   unixem_wDIR
 Handle type for wide string directory enumeration.
#define dirent   unixem_dirent
 Results structure for readdir().
#define wdirent   unixem_wdirent
 Results structure for wreaddir().
#define NAME_MAX   (260)

Typedefs

typedef struct dirent_dir unixem_DIR
typedef struct wdirent_dir unixem_wDIR

Functions

DIR * opendir (char const *name)
 Returns a pointer to the next directory entry.
int closedir (DIR *dir)
 Closes a directory handle.
void rewinddir (DIR *dir)
 Resets a directory search position.
struct dirent * readdir (DIR *dir)
 Returns a pointer to the next directory entry.
unixem_DIRunixem_opendir (char const *name)
 Returns a pointer to the next directory entry.
unixem_wDIRunixem_wopendir (wchar_t const *name)
 Identical semantics to opendir(), but for wide string searches.
int unixem_closedir (unixem_DIR *dir)
 Closes a directory handle.
int unixem_wclosedir (unixem_wDIR *dir)
 Identical semantics to closedir(), but for wide string searches.
void unixem_rewinddir (unixem_DIR *dir)
 Resets a directory search position.
void unixem_wrewinddir (unixem_wDIR *dir)
 Identical semantics to rewinddir(), but for wide string searches.
struct unixem_direntunixem_readdir (unixem_DIR *dir)
 Returns a pointer to the next directory entry.
struct unixem_wdirentunixem_wreaddir (unixem_wDIR *dir)
 Identical semantics to readdir(), but for wide string searches.


Define Documentation

#define DIR   unixem_DIR

Handle type for multibyte string directory enumeration.

See also:
unixem_DIR

Referenced by unixem_opendir().

#define dirent   unixem_dirent

Results structure for readdir().

See also:
unixem_dirent

Referenced by unixem_opendir().

#define NAME_MAX   (260)

The maximum number of characters (including null terminator) in a directory entry name

#define wDIR   unixem_wDIR

Handle type for wide string directory enumeration.

See also:
unixem_wDIR

#define wdirent   unixem_wdirent

Results structure for wreaddir().

See also:
unixem_wdirent


Typedef Documentation

typedef struct dirent_dir unixem_DIR

Handle type for multibyte string directory enumeration.

Note:
dirent_dir is defined internally

typedef struct wdirent_dir unixem_wDIR

Handle type for wide string directory enumeration.

Note:
dirent_dir is defined internally


Function Documentation

int closedir ( DIR *  dir  ) 

Closes a directory handle.

This function closes a directory handle that was opened with opendir() and releases any resources associated with that directory handle.

Parameters:
dir The directory handle from which the entries are read
Returns:
0 on success, or -1 to indicate error.
Note:
This is a macro, that resolves to unixem_closedir()

DIR* opendir ( char const *  name  ) 

Returns a pointer to the next directory entry.

This function opens the directory named by filename, and returns a directory to be used to in subsequent operations. NULL is returned if name cannot be accessed, or if resources cannot be acquired to process the request.

Parameters:
name The name of the directory to search
Returns:
The directory handle from which the entries are read or NULL
Note:
This is a macro, that resolves to unixem_opendir()

struct dirent* readdir ( DIR *  dir  )  [read]

Returns a pointer to the next directory entry.

This function returns a pointer to the next directory entry, or NULL upon reaching the end of the directory or detecting an invalid seekdir() operation

Parameters:
dir The directory handle from which the entries are read
Returns:
A dirent structure or NULL
Note:
This is a macro, that resolves to unixem_readdir()

Referenced by unixem_opendir().

void rewinddir ( DIR *  dir  ) 

Resets a directory search position.

This function resets the position of the named directory handle to the beginning of the directory.

Parameters:
dir The directory handle whose position should be reset
Note:
This is a macro, that resolves to unixem_rewinddir()

int unixem_closedir ( unixem_DIR dir  ) 

Closes a directory handle.

This function closes a directory handle that was opened with opendir() and releases any resources associated with that directory handle.

Parameters:
dir The directory handle from which the entries are read
Returns:
0 on success, or -1 to indicate error.

unixem_DIR* unixem_opendir ( char const *  name  ) 

Returns a pointer to the next directory entry.

This function opens the directory named by filename, and returns a directory to be used to in subsequent operations. NULL is returned if name cannot be accessed, or if resources cannot be acquired to process the request.

Parameters:
name The name of the directory to search
Returns:
The directory handle from which the entries are read or NULL

References DIR, dirent, and readdir().

struct unixem_dirent* unixem_readdir ( unixem_DIR dir  )  [read]

Returns a pointer to the next directory entry.

This function returns a pointer to the next directory entry, or NULL upon reaching the end of the directory or detecting an invalid seekdir() operation

Parameters:
dir The directory handle from which the entries are read
Returns:
A dirent structure or NULL

void unixem_rewinddir ( unixem_DIR dir  ) 

Resets a directory search position.

This function resets the position of the named directory handle to the beginning of the directory.

Parameters:
dir The directory handle whose position should be reset

int unixem_wclosedir ( unixem_wDIR dir  ) 

Identical semantics to closedir(), but for wide string searches.

unixem_wDIR* unixem_wopendir ( wchar_t const *  name  ) 

Identical semantics to opendir(), but for wide string searches.

struct unixem_wdirent* unixem_wreaddir ( unixem_wDIR dir  )  [read]

Identical semantics to readdir(), but for wide string searches.

void unixem_wrewinddir ( unixem_wDIR dir  ) 

Identical semantics to rewinddir(), but for wide string searches.


UNIX Emulation for Win32 Libraries documentation © Synesis Software Pty Ltd, 2002-2010