www.delorie.com/djgpp/doc/libc/libc_602.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

opendir

Syntax

 
#include <dirent.h>

extern int __opendir_flags;

DIR *opendir(char *name);

Description

This function "opens" a directory so that you can read the list of file names in it. The pointer returned must be passed to closedir when you are done with it. See section readdir.

The global variable __opendir_flags can be set to include the following values to control the operation of opendir:

__OPENDIR_PRESERVE_CASE
Do not change the case of files to lower case. Just in case Micros*ft decides to support case-sensitive file systems some day.

You can also use this flag if you want the names of files like `README' and `FAQ' from Unix distributions to be returned in upper-case on Windows 9X filesystems. See section _preserve_fncase, for other ways of achieving this and for more detailed description of the automatic letter-case conversion by DJGPP library functions.

__OPENDIR_NO_HIDDEN
Do not include hidden files and directories in the search. By default, all files and directories are included.

__OPENDIR_FIND_HIDDEN
Provided for back-compatibility with previous DJGPP versions, where hidden files and directories were by default skipped. In versions 2.02 and later, this flag has no effect.

__OPENDIR_FIND_LABEL
Include volume labels in the search. By default, these are skipped.

__OPENDIR_NO_D_TYPE
Do not compute the d_type member of struct dirent. If this flag is set, all files will get DT_UNKNOWN in the d_type member. By default, this flag is reset. See section readdir.

You can simply put `int __opendir_flags = ...;' in your code. The default is to let it get set to zero as an uninitialized variable.

Return Value

The open directory structure, or NULL on error.

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001 (see note 1)

Notes:

  1. The __opendir_flags variable is DJGPP-specific.

Example

 
DIR *d = opendir(".");
closedir(d);


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004