Name

wopendir - opening a directory with wide-character name

Library

libc.lib

Synopsis

  #include <wchar.h>
  WDIR * wopendir (const wchar_t *dirname);

Return values

The wopendir function returns a pointer to the directory stream or NULL if an error occurred.


Detailed description

The wopendir function opens the directory given by the wide-character name dirname, associates a directory stream with it and positions it at the first entry and returns a pointer to be used to identify the directory stream in subsequent operations. The pointer NULL is returned if dirname cannot be accessed, or if it cannot malloc enough memory to hold the whole thing.



Examples

/*************************************************************************************************************
* Detailed description: This test code demonstrates usage of wopendir system call, open directory wide name "test".
*
* Preconditions: Expects "test" directory to be present in the current working directory.
**************************************************************************************************************/
 #include <wchar.h>
 #include <stdio.h>
 #include <dirent.h>
int main()
{
  WDIR *WDirHandle;
  if(!(WDirHandle = wopendir(L"test") ) ) 
  {
     printf("Failed to open directory test\n");
     return -1;
  }
  printf("Directory test opened \n");
  wclosedir(WDirHandle);
  return 0;
}

         

Output

Directory test opened

         


Errors

The wopendir system call will fail if:
[EINVAL]
  Invalid argument.
[ENAMETOOLONG]
  A component of a pathname exceeded 255 characters.
[ENOENT]
  The named file does not exist.
[EMFILE]
  Too many file descriptors in use by process.
[ENOMEM]
  Insufficient memory to complete the operation.
[ENOTDIR]
  dirname is not a directory.


See also

opendir, close, lseek, open, read

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top