HP 3000 Manuals

rewinddir [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation


MPE/iX Developer's Kit Reference Manual Volume I

rewinddir 

Resets an open directory stream to point to the first entry of the
directory.

Syntax 

     #include <sys/types.h>
     #include <dirent.h>
     int rewinddir (DIR *dirp);

Parameters 

dirp       A pointer to an open directory stream obtained from a
           successful call to opendir().

Return Values 

0          The position is successfully reset.

-1         An error occurred.  The current position is not changed, and
           errno is set to indicate the error condition.

Description 

The rewinddir() function resets the position of the directory stream to
which dirp refers to the first entry of the directory.  It also causes
the directory stream to refer to the current state of the directory, as a
call to opendir() does.

Implementation Considerations 

Refer to the EFAULT error description below.

The return type of rewinddir() is int to be able to return a value
indicating an error.  The POSIX.1 standard calls for no value to be
returned (void).  A strictly conforming POSIX application should not
evaluate the return of rewinddir().

The type DIR is implemented using a file descriptor.

Errors 

If an error occurs, errno is set to one of the following values:

EBADF             CAUSE           The dirp parameter does not refer to an open
                                  directory stream.
                  ACTION          Pass an open directory stream pointer returned by the
                                  opendir() function.

EFAULT            CAUSE           The system detected a NULL or bad address in
                                  attempting to use the dirp parameter.
                  ACTION          Make sure that the pointer is correctly initialized.

See Also 

mkdir(), closedir(), opendir(), readdir(), <dirent.h>, POSIX.1 Section
5.1.2.



MPE/iX 5.0 Documentation