Download RTEMS POSIX API User's Guide

Transcript
64
RTEMS POSIX API User’s Guide
4.4.2 readdir - Reads a directory
CALLING SEQUENCE:
#include <sys/types.h>
#include <dirent.h>
int readdir(
DIR *dirp
);
STATUS CODES:
EBADF
Invalid file descriptor
DESCRIPTION:
The readdir() function returns a pointer to a structure dirent representing the next
directory entry from the directory stream pointed to by dirp. On end-of-file, NULL is
returned.
The readdir() function may (or may not) return entries for . or .. Your program should
tolerate reading dot and dot-dot but not require them.
The data pointed to be readdir() may be overwritten by another call to readdir() for
the same directory stream. It will not be overwritten by a call for another directory.
NOTES:
If ptr is not a pointer returned by malloc(), calloc(), or realloc() or has been deallocated with free() or realloc(), the results are not portable and are probably disastrous.
The routine is implemented in Cygnus newlib.