Synesis Software

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

This API provides facilities for enumerating the contents of directories. More...

Classes

struct  dirent
 Results structure for readdir(). More...
struct  wdirent
 Results structure for wreaddir(). More...

Defines

#define NAME_MAX   (260)
 The maximum number of characters (including null terminator) in a directory entry name.

Typedefs

typedef struct dirent_dir DIR
 Handle type for ANSI directory enumeration.
typedef struct wdirent_dir wDIR
 Handle type for Unicode directory enumeration.

Functions

DIRopendir (const char *name)
 Returns a pointer to the next directory entry.
wDIRwopendir (const wchar_t *name)
 Identical semantics to opendir(), but for Unicode searches.
int closedir (DIR *dir)
 Closes a directory handle.
int wclosedir (wDIR *dir)
 Identical semantics to closedir(), but for Unicode searches.
void rewinddir (DIR *dir)
 Resets a directory search position.
void wrewinddir (wDIR *dir)
 Identical semantics to rewinddir(), but for Unicode searches.
struct direntreaddir (DIR *dir)
 Returns a pointer to the next directory entry.
struct wdirentwreaddir (wDIR *dir)
 Identical semantics to readdir(), but for Unicode searches.

Detailed Description

This API provides facilities for enumerating the contents of directories.


Define Documentation

#define NAME_MAX   (260)

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


Typedef Documentation

typedef struct dirent_dir DIR

Handle type for ANSI directory enumeration.

Note:
dirent_dir is defined internally

typedef struct wdirent_dir wDIR

Handle type for Unicode 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.

DIR* opendir ( const char *  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

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

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

int wclosedir ( wDIR dir  ) 

Identical semantics to closedir(), but for Unicode searches.

wDIR* wopendir ( const wchar_t *  name  ) 

Identical semantics to opendir(), but for Unicode searches.

struct wdirent* wreaddir ( wDIR dir  )  [read]

Identical semantics to readdir(), but for Unicode searches.

void wrewinddir ( wDIR dir  ) 

Identical semantics to rewinddir(), but for Unicode searches.


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