Skip to content

Latest commit

 

History

History
80 lines (56 loc) · 2.78 KB

rmdir-wrmdir.md

File metadata and controls

80 lines (56 loc) · 2.78 KB
description title ms.date api_name api_location api_type topic_type f1_keywords helpviewer_keywords ms.assetid
Learn more about: _rmdir, _wrmdir
_rmdir, _wrmdir
4/2/2020
_wrmdir
_rmdir
_o__rmdir
_o__wrmdir
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-filesystem-l1-1-0.dll
DLLExport
apiref
trmdir
_trmdir
wrmdir
_rmdir
_wrmdir
_rmdir function
directories [C++], deleting
rmdir function
directories [C++], removing
trmdir function
_trmdir function
_wrmdir function
wrmdir function
652c2a5a-b0ac-4493-864e-1edf484333c5

_rmdir, _wrmdir

Deletes a directory.

Syntax

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

Parameters

dirname
Path of the 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:

errno value Condition
ENOTEMPTY Given path isn't a directory, the directory isn't 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 errno, _doserrno, _sys_errlist, and _sys_nerr.

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.

By default, this function's global state is scoped to the application. To change this behavior, see Global state in the CRT.

Generic-text routine mappings

Tchar.h routine _UNICODE and _MBCS not defined _MBCS defined _UNICODE defined
_trmdir _rmdir _rmdir _wrmdir

Requirements

Routine Required header
_rmdir <direct.h>
_wrmdir <direct.h> or <wchar.h>

For more compatibility information, see Compatibility.

Libraries

All versions of the C run-time libraries.

Example

See the example for _mkdir.

See also

Directory control
_chdir, _wchdir
_mkdir, _wmkdir