#include <wchar.h>
|
#include <dirent.h>
|
struct wdirent *
wreaddir (WDIR *dirp);
|
The wreaddir function returns a pointer to a wdirent structure, or NULL if an error occurs or end-of-file is reached.
The wreaddir function returns a wdirent pointer to the next directory entry. It returns NULL upon reaching the end of the directory or detecting an invalid wreaddir operation on the directory stream. The new position reverts to the one associated with the directory stream when the wtelldir operation was performed.
Note:
Any changes happening to directory after wopendir call, will not be reflected by subsequent wreaddir calls.
/** * Detailed description: Sample usage of wreaddir call * Preconditions: Example Directory should be present in current working directory and should contain atleast one file/directory. **/ #include <dirent.h> #include <unistd.h> #include <wchar.h> int main() { WDIR *dirName; struct wdirent *Dir; dirName = wopendir(L"Example"); if(dirName == NULL ) { printf("Failed to open directory \n"); return -1; } if(!(Dir = wreaddir(dirName)) ) { printf("Read dir failed \n"); return -1; } printf("Directory Example read \n"); wclosedir(dirName); return 0; }
Output
Directory Example read
[EINVAL] | |
Invalid argument. | |
[ENOENT] | |
The named file does not exist. | |
[ENOTDIR] | |
dirname is not a directory. | |
[EBADF] | |
Invalid file descriptor fd. | |
[EFAULT] | |
Argument points outside the calling processâs address space. | |
[EINVAL] | |
Result buffer is too small.
|
|
© 2005-2007 Nokia |