Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <direct.h>
    int closedir( struct dirent *dirp );
    int _wclosedir( struct _wdirent *dirp );

Description:
    The closedir function closes the directory specified by dirp and frees
    the memory allocated by  opendir.

    The _wclosedir function is identical to closedir except that it closes a
    directory of wide-character filenames opened by  _wopendir.

Returns:
    The closedir function returns zero if successful, non-zero otherwise.

Errors:
    When an error has occurred,  errno contains a value indicating the type
    of error that has been detected.

    Constant     Meaning

EBADF
    The argument dirp does not refer to an open directory stream.


Example:
    To get a list of files contained in the directory \watcom\h on your
    default disk:

    #include <stdio.h>
    #include <direct.h>

    void main()
      {
        DIR *dirp;
        struct dirent *direntp;

        dirp = opendir( "\\watcom\\h" );
        if( dirp != NULL ) {

          for(;;) {
            direntp = readdir( dirp );
            if( direntp == NULL ) break;
            printf( "%s\n", direntp->d_name );
          }

          closedir( dirp );
        }
      }

    Note the use of two adjacent backslash characters (\) within
    character-string constants to signify a single backslash.

Classification:
    closedir is POSIX 1003.1, _wclosedir is not POSIX

Systems:
     closedir - All, Netware

    _wclosedir - DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32

See Also:
    _dos_find Functions, opendir, readdir, rewinddir

See Also:

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson