_rmdir, _wrmdir

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _rmdir, _wrmdir.

Deletes a directory.

  
      int _rmdir(  
   const char *dirname   
);  
int _wrmdir(  
   const wchar_t *dirname   
);  

Parameters

dirname
Path of the directory to be removed.

Each of these functions returns 0 if the directory is successfully deleted. A return value of –1 indicates an error and errno is set to one of the following values:

ENOTEMPTY
Given path is not a directory, the directory is not empty, or the directory is either the current working directory or the root directory.

ENOENT
Path is invalid.

EACCES
A program has an open handle to the directory.

For more information about these and other return codes, see _doserrno, errno, _sys_errlist, and _sys_nerr.

The _rmdir function deletes the directory specified by dirname. The directory must be empty, and it must not be the current working directory or the root directory.

_wrmdir is a wide-character version of _rmdir; the dirname argument to _wrmdir is a wide-character string. _wrmdir and _rmdir behave identically otherwise.

Generic-Text Routine Mappings

Tchar.h routine_UNICODE and _MBCS not defined_MBCS defined_UNICODE defined
_trmdir_rmdir_rmdir_wrmdir
RoutineRequired header
_rmdir<direct.h>
_wrmdir<direct.h> or <wchar.h>

For more compatibility information, see Compatibility in the Introduction.

All versions of the C run-time libraries.

See the example for _mkdir.

System::IO::Directory::Delete

Directory Control
_chdir, _wchdir
_mkdir, _wmkdir

Show: