_rmdir, _wrmdir
Delete a directory.
int _rmdir( const char *dirname ); int _wrmdir( const wchar_t *dirname );
Parameters
- dirname
- Path of directory to be removed.
Return Value
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; directory is not empty; or directory is either current working directory or root directory.
- ENOENT
- Path is invalid.
- EACCESS
- A program has an open handle to the directory.
See _doserrno, errno, _sys_errlist, and _sys_nerr for more information on these and other return codes.
Remarks
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 & _MBCS not defined | _MBCS defined | _UNICODE defined |
|---|---|---|---|
| _trmdir | _rmdir | _rmdir | _wrmdir |
Requirements
| Routine | Required header | Compatibility |
|---|---|---|
| _rmdir | <direct.h> | Win 98, Win Me, Win NT, Win 2000, Win XP |
| _wrmdir | <direct.h> or <wchar.h> | Win NT, Win 2000, Win XP |
For additional compatibility information, see Compatibility in the Introduction.
Libraries
All versions of the C run-time libraries.
Example
See the example for _mkdir.
See Also
Directory Control Routines | _chdir | _mkdir | Run-Time Routines and .NET Framework Equivalents