Name

wreaddir - reading a directory with wide-character name

Library

libc.lib

Synopsis

  #include <wchar.h>
  #include <dirent.h>
  struct wdirent * wreaddir (WDIR *dirp);


Return values

The wreaddir function returns a pointer to a wdirent structure, or NULL if an error occurs or end-of-file is reached.


Detailed description

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.



Examples

 /**
  * 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

         


Errors

The wreaddir system call will fail if:
[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.



See also

wopendir, wreaddir, wrewinddir, wtelldir, wseekdir, wclosedir, opendir, readdir, rewinddir, telldir, seekdir, closedir, close, lseek, open, read, dir

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top